apps/nshlib: I was able to cause an assertion with some typos in an testing the 'fi' command. Not an important thing, but this will protect against the assertion.
This commit is contained in:
parent
5cfe9c2787
commit
ff192a4a58
@ -1777,7 +1777,7 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
|||||||
bool inverted = false;
|
bool inverted = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (cmd)
|
if (cmd != NULL)
|
||||||
{
|
{
|
||||||
/* Check if the command is preceded by "while" or "until" */
|
/* Check if the command is preceded by "while" or "until" */
|
||||||
|
|
||||||
@ -1791,7 +1791,7 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
|||||||
/* Get the cmd following the "while" or "until" */
|
/* Get the cmd following the "while" or "until" */
|
||||||
|
|
||||||
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
||||||
if (!*ppcmd)
|
if (*ppcmd == NULL || **ppcmd == '\0')
|
||||||
{
|
{
|
||||||
nsh_output(vtbl, g_fmtarginvalid, cmd);
|
nsh_output(vtbl, g_fmtarginvalid, cmd);
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -1806,7 +1806,7 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
|||||||
/* Get the next cmd */
|
/* Get the next cmd */
|
||||||
|
|
||||||
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
||||||
if (!*ppcmd)
|
if (*ppcmd == NULL || **ppcmd == '\0')
|
||||||
{
|
{
|
||||||
nsh_output(vtbl, g_fmtarginvalid, cmd);
|
nsh_output(vtbl, g_fmtarginvalid, cmd);
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -1983,7 +1983,7 @@ static int nsh_itef(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
|||||||
bool disabled;
|
bool disabled;
|
||||||
bool inverted = false;
|
bool inverted = false;
|
||||||
|
|
||||||
if (cmd)
|
if (cmd != NULL)
|
||||||
{
|
{
|
||||||
/* Check if the command is preceded by "if" */
|
/* Check if the command is preceded by "if" */
|
||||||
|
|
||||||
@ -1992,7 +1992,7 @@ static int nsh_itef(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
|||||||
/* Get the cmd following the if */
|
/* Get the cmd following the if */
|
||||||
|
|
||||||
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
||||||
if (!*ppcmd)
|
if (*ppcmd == NULL || **ppcmd == '\0')
|
||||||
{
|
{
|
||||||
nsh_output(vtbl, g_fmtarginvalid, "if");
|
nsh_output(vtbl, g_fmtarginvalid, "if");
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -2007,7 +2007,7 @@ static int nsh_itef(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
|||||||
/* Get the next cmd */
|
/* Get the next cmd */
|
||||||
|
|
||||||
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
||||||
if (!*ppcmd)
|
if (*ppcmd == NULL || **ppcmd == '\0')
|
||||||
{
|
{
|
||||||
nsh_output(vtbl, g_fmtarginvalid, "if");
|
nsh_output(vtbl, g_fmtarginvalid, "if");
|
||||||
goto errout;
|
goto errout;
|
||||||
|
Loading…
Reference in New Issue
Block a user