summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/menu.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2023-02-05 21:26:49 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2023-02-05 21:26:49 +0000
commit832a7de8e6d33dd9a4c1f278a5989d30df24e16b (patch)
treedcb683d0bd831f20d864be7629f14d050d071192 /usr.bin/tmux/menu.c
parent29abf235e7594c18895ae1c0ad3f0df5f4d67743 (diff)
Do not allow multiple line separators in a row.
Diffstat (limited to 'usr.bin/tmux/menu.c')
-rw-r--r--usr.bin/tmux/menu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c
index 52387036430..e1efa60e72d 100644
--- a/usr.bin/tmux/menu.c
+++ b/usr.bin/tmux/menu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: menu.c,v 1.48 2023/01/20 21:36:00 nicm Exp $ */
+/* $OpenBSD: menu.c,v 1.49 2023/02/05 21:26:48 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);