From 6b0fa14470df848ae0735a3e0bab393c241acb86 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 25 May 2019 07:15:53 +0000 Subject: Fix error handling in if-shell. --- cmd-if-shell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd-if-shell.c') diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 40e2b1c3..84f66657 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -159,7 +159,7 @@ cmd_if_shell_callback(struct job *job) struct cmd_if_shell_data *cdata = job_get_data(job); struct client *c = cdata->client; struct mouse_event *m = &cdata->mouse; - struct cmdq_item *new_item; + struct cmdq_item *new_item = NULL; char *cmd; int status; struct cmd_parse_result *pr; @@ -175,10 +175,10 @@ cmd_if_shell_callback(struct job *job) pr = cmd_parse_from_string(cmd, &cdata->input); switch (pr->status) { case CMD_PARSE_EMPTY: - new_item = NULL; break; case CMD_PARSE_ERROR: - new_item = cmdq_get_error(pr->error); + if (cdata->item != NULL) + cmdq_error(cdata->item, "%s", pr->error); free(pr->error); break; case CMD_PARSE_SUCCESS: -- cgit v1.2.3