mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 04:26:04 +08:00
apps/nshlib/nsh_console.c: Do not dereference NULL 'pstate'
This commit is contained in:

committed by
Gregory Nutt

parent
b33eaf881d
commit
cef306e335
@@ -448,6 +448,12 @@ FAR struct console_stdio_s *nsh_newconsole(void)
|
|||||||
pstate->cn_vtbl.linebuffer = nsh_consolelinebuffer;
|
pstate->cn_vtbl.linebuffer = nsh_consolelinebuffer;
|
||||||
pstate->cn_vtbl.exit = nsh_consoleexit;
|
pstate->cn_vtbl.exit = nsh_consoleexit;
|
||||||
|
|
||||||
|
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||||
|
/* Set the initial option flags */
|
||||||
|
|
||||||
|
pstate->cn_vtbl.np.np_flags = NSH_NP_SET_OPTIONS_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_NFILE_STREAMS > 0
|
#if CONFIG_NFILE_STREAMS > 0
|
||||||
pstate->cn_vtbl.redirect = nsh_consoleredirect;
|
pstate->cn_vtbl.redirect = nsh_consoleredirect;
|
||||||
pstate->cn_vtbl.undirect = nsh_consoleundirect;
|
pstate->cn_vtbl.undirect = nsh_consoleundirect;
|
||||||
@@ -480,11 +486,5 @@ FAR struct console_stdio_s *nsh_newconsole(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
|
||||||
/* Set the initial option flags */
|
|
||||||
|
|
||||||
pstate->cn_vtbl.np.np_flags = NSH_NP_SET_OPTIONS_INIT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return pstate;
|
return pstate;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user