Stop a null pointer dereference in the builtin hash function.

PR:		36141
Approved by:	cracauer
MFC after:	1 week
This commit is contained in:
George C A Reid 2002-04-15 15:49:30 +00:00
parent fc27278b9b
commit 4c7e4a544a

View File

@ -350,7 +350,10 @@ hashcmd(int argc __unused, char **argv __unused)
if (verbose) {
if (entry.cmdtype != CMDUNKNOWN) { /* if no error msg */
cmdp = cmdlookup(name, 0);
printentry(cmdp, verbose);
if (cmdp != NULL)
printentry(cmdp, verbose);
else
outfmt(&errout, "%s: not found\n", name);
}
flushall();
}