AP_Menu: fixed crash bug in strtok_r() handling

on PX4 this causes a hard fault in CLI menus
This commit is contained in:
Andrew Tridgell 2013-04-17 22:20:00 +10:00
parent b05117f5cd
commit 68051f3ea6
1 changed files with 2 additions and 1 deletions

View File

@ -39,7 +39,7 @@ Menu::run(void)
uint8_t len, i;
uint8_t argc;
int c;
char *s;
char *s = NULL;
if (_port == NULL) {
// default to main serial port
@ -87,6 +87,7 @@ Menu::run(void)
// split the input line into tokens
argc = 0;
s = NULL;
_argv[argc++].str = strtok_r(_inbuf, " ", &s);
// XXX should an empty line by itself back out of the current menu?
while (argc <= MENU_ARGS_MAX) {