mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 19:44:35 +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.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
|
||||
pstate->cn_vtbl.redirect = nsh_consoleredirect;
|
||||
pstate->cn_vtbl.undirect = nsh_consoleundirect;
|
||||
@@ -480,11 +486,5 @@ FAR struct console_stdio_s *nsh_newconsole(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
/* Set the initial option flags */
|
||||
|
||||
pstate->cn_vtbl.np.np_flags = NSH_NP_SET_OPTIONS_INIT;
|
||||
#endif
|
||||
|
||||
return pstate;
|
||||
}
|
||||
|
Reference in New Issue
Block a user