mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-25 18:18:49 -04:00
desktop: fixed 2 crashes in the menu code
handle an empty line gracefully, and use pgm_read_pointer() for functions pointers in progmem
This commit is contained in:
parent
152da9c91b
commit
75d7ee01d1
@ -87,6 +87,10 @@ Menu::run(void)
|
|||||||
argc++;
|
argc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_argv[0].str == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// populate arguments that have not been specified with "" and 0
|
// populate arguments that have not been specified with "" and 0
|
||||||
// this is safer than NULL in the case where commands may look
|
// this is safer than NULL in the case where commands may look
|
||||||
// without testing argc
|
// without testing argc
|
||||||
@ -136,6 +140,6 @@ Menu::_call(uint8_t n, uint8_t argc)
|
|||||||
{
|
{
|
||||||
func fn;
|
func fn;
|
||||||
|
|
||||||
fn = (func)pgm_read_word(&_commands[n].func);
|
fn = (func)pgm_read_pointer(&_commands[n].func);
|
||||||
return(fn(argc, &_argv[0]));
|
return(fn(argc, &_argv[0]));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user