From 5571d7a21c5dc920eb9d25336b5bb7b04d72fc9d Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 22 May 2019 18:58:31 +0000 Subject: [PATCH] Fix crash if window doesn't exist, GitHub issue 1751. --- cmd-show-options.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd-show-options.c b/cmd-show-options.c index 1e1518f6..2b4651b9 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -91,7 +91,14 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) window = (self->entry == &cmd_show_window_options_entry); if (args->argc == 0) { - options_scope_from_flags(args, window, fs, &oo, &cause); + scope = options_scope_from_flags(args, window, fs, &oo, &cause); + if (scope == OPTIONS_TABLE_NONE) { + if (args_has(args, 'q')) + return (CMD_RETURN_NORMAL); + cmdq_error(item, "%s", cause); + free(cause); + return (CMD_RETURN_ERROR); + } return (cmd_show_options_all(self, item, oo)); } argument = format_single(item, args->argv[0], c, s, wl, NULL);