summaryrefslogtreecommitdiffstats
path: root/cmd-queue.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-21 17:25:32 +0000
committernicm <nicm>2021-08-21 17:25:32 +0000
commit5241dae87de88906dc5c1dc271a4f25522a22d4c (patch)
tree17be354eb3556ed62cfdc74f2a8e4ecfe6599a22 /cmd-queue.c
parent68cacaec68ca8300e0ea439abdf9db16e74241bb (diff)
Stop caring about empty commands, just treat as a null command.
Diffstat (limited to 'cmd-queue.c')
-rw-r--r--cmd-queue.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd-queue.c b/cmd-queue.c
index 806f1cbb..4fbdc4e7 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -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);