From af983ad3d35e32de0288fa287d56ee35e1d2617c Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 13 May 2024 14:49:54 +0200 Subject: [PATCH] lvmcmdline: check for NULL Althought this code likely never is hit with NULL, just add check to be sure. --- tools/lvmcmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 1ade744b2..3fd23a521 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1993,7 +1993,7 @@ static void _short_usage(const char *name) static int _usage(const char *name, int longhelp, int skip_notes) { const struct command_name *cname = find_command_name(name); - const struct command_name_args *cna = &command_names_args[cname->lvm_command_enum]; + const struct command_name_args *cna = cname ? &command_names_args[cname->lvm_command_enum] : NULL; struct command *cmd = NULL; int show_full = longhelp; int i;