Merge pull request #29 from TobiasRH/fix-separator-segfault
Fix a segfault if a sub-menu is added to a separator.
This commit is contained in:
commit
c4d552d669
8
xmenu.c
8
xmenu.c
|
@ -432,6 +432,10 @@ buildmenutree(unsigned level, const char *label, const char *output, char *file)
|
||||||
for (item = prevmenu->list; item->next != NULL; item = item->next)
|
for (item = prevmenu->list; item->next != NULL; item = item->next)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* a separator is no valid root for a submenu */
|
||||||
|
if (!item->label)
|
||||||
|
errx(1, "a separator is no valid root for a submenu");
|
||||||
|
|
||||||
prevmenu = menu;
|
prevmenu = menu;
|
||||||
menu->caller = item;
|
menu->caller = item;
|
||||||
item->submenu = menu;
|
item->submenu = menu;
|
||||||
|
@ -717,8 +721,10 @@ setupmenu(struct Menu *menu, XClassHint *classh)
|
||||||
/* set window title (used if wflag is on) */
|
/* set window title (used if wflag is on) */
|
||||||
if (menu->parent == NULL) {
|
if (menu->parent == NULL) {
|
||||||
title = classh->res_name;
|
title = classh->res_name;
|
||||||
} else {
|
} else if (menu->caller->output) {
|
||||||
title = menu->caller->output;
|
title = menu->caller->output;
|
||||||
|
} else {
|
||||||
|
title = "\0";
|
||||||
}
|
}
|
||||||
XStringListToTextProperty(&title, 1, &wintitle);
|
XStringListToTextProperty(&title, 1, &wintitle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user