nshlib/nsh_consolemain: detect null pointer

Returning with an error from nsh_consolemain prevents dereferencing a
NULL pointer later in the code.
This commit is contained in:
Niklas Hauser 2023-08-28 13:43:54 +02:00 committed by Xiang Xiao
parent 7981278021
commit 78a6d07a90

View File

@ -65,6 +65,10 @@ int nsh_consolemain(int argc, FAR char *argv[])
int ret;
DEBUGASSERT(pstate != NULL);
if (pstate == NULL)
{
return -ENOMEM;
}
/* Execute the session */