tool_help: fix a NULL deref in the --help option code

Follow-up to 9a0cf56471

Pointed out by CodeSonar

Closes #14391
This commit is contained in:
Daniel Stenberg 2024-08-05 08:39:08 +02:00
parent 0238a9b0d7
commit b9d465c89f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -264,7 +264,7 @@ void tool_help(char *category)
noflagged = TRUE;
}
a = findlongopt(lookup);
if(noflagged && (ARGTYPE(a->desc) != ARG_BOOL))
if(a && noflagged && (ARGTYPE(a->desc) != ARG_BOOL))
/* a --no- prefix for a non-boolean is not specifying a proper
option */
a = NULL;