From 5d57355ae9e3e71f5b19a183a69a79071f13f0f2 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Mar 2021 13:06:33 +0000 Subject: [PATCH] Do not crash if there is no item to show command error, from Anindya Mukherjee. --- usr.bin/tmux/cmd-run-shell.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 5a30b93be78..67e8b446905 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.71 2021/03/02 10:56:45 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.72 2021/03/15 13:06:33 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -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); } } -- 2.20.1