summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-queue.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-08-21 17:25:33 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-08-21 17:25:33 +0000
commit875c2b0b8f7f7acb0557452e782e2da8db5adab7 (patch)
tree1f40398f1fc71878d6173c4b12e273eb99f0e8bb /usr.bin/tmux/cmd-queue.c
parentcfe83787625d008d51ad0a0b535fed82147c5ac7 (diff)
Stop caring about empty commands, just treat as a null command.
Diffstat (limited to 'usr.bin/tmux/cmd-queue.c')
-rw-r--r--usr.bin/tmux/cmd-queue.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c
index 5ec234b42bb..7d36f3cb8be 100644
--- a/usr.bin/tmux/cmd-queue.c
+++ b/usr.bin/tmux/cmd-queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-queue.c,v 1.106 2021/08/21 10:28:05 nicm Exp $ */
+/* $OpenBSD: cmd-queue.c,v 1.107 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -478,6 +478,13 @@ cmdq_remove_group(struct cmdq_item *item)
}
}
+/* Empty command callback. */
+static enum cmd_retval
+cmdq_empty_command(__unused struct cmdq_item *item, __unused void *data)
+{
+ return (CMD_RETURN_NORMAL);
+}
+
/* Get a command for the command queue. */
struct cmdq_item *
cmdq_get_command(struct cmd_list *cmdlist, struct cmdq_state *state)
@@ -487,12 +494,14 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmdq_state *state)
const struct cmd_entry *entry;
int created = 0;
+ if ((cmd = cmd_list_first(cmdlist)) == NULL)
+ return (cmdq_get_callback(cmdq_empty_command, NULL));
+
if (state == NULL) {
state = cmdq_new_state(NULL, NULL, 0);
created = 1;
}
- cmd = cmd_list_first(cmdlist);
while (cmd != NULL) {
entry = cmd_get_entry(cmd);