mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
src/menu: Handle menu item creation failure
This commit is contained in:
parent
505f92e733
commit
2aaf26e87b
1 changed files with 8 additions and 2 deletions
|
|
@ -268,7 +268,11 @@ handle_menu_element(xmlNode *n, struct server *server)
|
|||
* create an item pointing to the new submenu
|
||||
*/
|
||||
current_item = item_create(current_menu, label);
|
||||
if (current_item) {
|
||||
submenu = ¤t_item->submenu;
|
||||
} else {
|
||||
submenu = NULL;
|
||||
}
|
||||
}
|
||||
++menu_level;
|
||||
current_menu = menu_create(server, id, label);
|
||||
|
|
@ -282,7 +286,9 @@ handle_menu_element(xmlNode *n, struct server *server)
|
|||
struct menu *menu = menu_get_by_id(id);
|
||||
if (menu) {
|
||||
current_item = item_create(current_menu, menu->label);
|
||||
if (current_item) {
|
||||
current_item->submenu = menu;
|
||||
}
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "no menu with id '%s'", id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue