mirror of
https://github.com/labwc/labwc.git
synced 2026-03-20 05:34:12 -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 *
|
static struct menuitem *
|
||||||
separator_create(struct menu *menu, const char *label)
|
separator_create(struct menu *menu, const char *label)
|
||||||
{
|
{
|
||||||
|
assert(menu);
|
||||||
|
|
||||||
struct menuitem *menuitem = znew(*menuitem);
|
struct menuitem *menuitem = znew(*menuitem);
|
||||||
menuitem->parent = menu;
|
menuitem->parent = menu;
|
||||||
menuitem->selectable = false;
|
menuitem->selectable = false;
|
||||||
|
|
@ -754,6 +756,11 @@ xml_tree_walk(struct menu_parse_context *ctx, xmlNode *node)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcasecmp((char *)n->name, "separator")) {
|
if (!strcasecmp((char *)n->name, "separator")) {
|
||||||
|
if (!ctx->menu) {
|
||||||
|
wlr_log(WLR_ERROR,
|
||||||
|
"ignoring <separator> without parent <menu>");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
handle_separator_element(ctx, n);
|
handle_separator_element(ctx, n);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue