Do not allow multiple line separators in a row.

This commit is contained in:
nicm 2023-02-05 21:26:48 +00:00
parent 93b1b78150
commit 0cb75f1332

2
menu.c
View File

@ -64,6 +64,8 @@ menu_add_item(struct menu *menu, const struct menu_item *item,
line = (item == NULL || item->name == NULL || *item->name == '\0');
if (line && menu->count == 0)
return;
if (line && menu->items[menu->count - 1].name == NULL)
return;
menu->items = xreallocarray(menu->items, menu->count + 1,
sizeof *menu->items);