summaryrefslogtreecommitdiffstats
path: root/cmd-run-shell.c
diff options
context:
space:
mode:
authornicm <nicm>2021-03-15 13:06:33 +0000
committernicm <nicm>2021-03-15 13:06:33 +0000
commit9017af23556abdc31ba37c925adf6e0f1bb12671 (patch)
tree42d2cd21ebed76c2cbbc6579b14e42be1aab1d6c /cmd-run-shell.c
parente8224fb0d123ca9042b0703a35e1a33f0787d327 (diff)
Do not crash if there is no item to show command error, from Anindya
Mukherjee.
Diffstat (limited to 'cmd-run-shell.c')
-rw-r--r--cmd-run-shell.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index 4f30d05d..73ed79f4 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -190,8 +191,12 @@ cmd_run_shell_timer(__unused int fd, __unused short events, void* arg)
&error);
}
if (status == CMD_PARSE_ERROR) {
- cmdq_error(cdata->item, "%s", error);
- free(error);
+ if (cdata->item == NULL) {
+ *error = toupper((u_char)*error);
+ status_message_set(c, -1, 1, "%s", error);
+ } else
+ cmdq_error(cdata->item, "%s", error);
+ free(error);
}
}