nrf51: Fix crash with not argument given to "mon read".
This commit is contained in:
parent
db2f403417
commit
4ecd13a9a3
@ -283,15 +283,15 @@ static bool nrf51_cmd_read_help(target *t)
|
|||||||
static bool nrf51_cmd_read(target *t, int argc, const char *argv[])
|
static bool nrf51_cmd_read(target *t, int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
const struct command_s *c;
|
const struct command_s *c;
|
||||||
|
if (argc > 1) {
|
||||||
for(c = nrf51_read_cmd_list; c->cmd; c++) {
|
for(c = nrf51_read_cmd_list; c->cmd; c++) {
|
||||||
/* Accept a partial match as GDB does.
|
/* Accept a partial match as GDB does.
|
||||||
* So 'mon ver' will match 'monitor version'
|
* So 'mon ver' will match 'monitor version'
|
||||||
*/
|
*/
|
||||||
if(!strncmp(argv[1], c->cmd, strlen(argv[1])))
|
if(!strncmp(argv[1], c->cmd, strlen(argv[1])))
|
||||||
return !c->handler(t, argc - 1, &argv[1]);
|
return !c->handler(t, argc - 1, &argv[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nrf51_cmd_read_help(t);
|
return nrf51_cmd_read_help(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user