mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
menu: fix segfault with toplevel <separator>
Before this patch, labwc crashed menu.xml like this: <openbox_menu> <separator /> </openbox_menu>
This commit is contained in:
parent
00ed40454d
commit
03004cf44b
1 changed files with 7 additions and 0 deletions
|
|
@ -269,6 +269,8 @@ item_create_scene(struct menuitem *menuitem, int *item_y)
|
|||
static struct menuitem *
|
||||
separator_create(struct menu *menu, const char *label)
|
||||
{
|
||||
assert(menu);
|
||||
|
||||
struct menuitem *menuitem = znew(*menuitem);
|
||||
menuitem->parent = menu;
|
||||
menuitem->selectable = false;
|
||||
|
|
@ -754,6 +756,11 @@ xml_tree_walk(struct menu_parse_context *ctx, xmlNode *node)
|
|||
continue;
|
||||
}
|
||||
if (!strcasecmp((char *)n->name, "separator")) {
|
||||
if (!ctx->menu) {
|
||||
wlr_log(WLR_ERROR,
|
||||
"ignoring <separator> without parent <menu>");
|
||||
continue;
|
||||
}
|
||||
handle_separator_element(ctx, n);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue