apps/nshlib/nsh_console.c: Do not dereference NULL 'pstate'

This commit is contained in:
Juha Niskanen
2018-08-29 06:18:30 -06:00
committed by Gregory Nutt
parent b33eaf881d
commit cef306e335

View File

@@ -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;
}