From d475e0e52fc4cfdd2dcb271be477114d890f6b24 Mon Sep 17 00:00:00 2001 From: Jim Ramsay Date: Mon, 2 Jan 2023 20:15:12 -0500 Subject: [PATCH] Fix segfault for wayvncctl help --command=bad-name Signed-off-by: Jim Ramsay --- src/ctl-client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ctl-client.c b/src/ctl-client.c index fb91e00..3e440d1 100644 --- a/src/ctl-client.c +++ b/src/ctl-client.c @@ -650,6 +650,10 @@ static int print_command_usage(const char* cmd_name, struct option_parser* parent_options) { struct cmd_info* info = ctl_command_by_name(cmd_name); + if (!info) { + WARN("No such command \"%s\"\n", cmd_name); + return 1; + } printf("Usage: wayvncctl [options] %s [parameters]\n\n%s\n\n", cmd_name, info->description); option_parser_print_options(cmd_options, stdout);