Skip to content

Commit

Permalink
nrf51: Fix crash with not argument given to "mon read".
Browse files Browse the repository at this point in the history
  • Loading branch information
UweBonnes committed Dec 22, 2018
1 parent 1026b15 commit d164cf8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/target/nrf51.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ static bool nrf51_cmd_read_help(target *t)
static bool nrf51_cmd_read(target *t, int argc, const char *argv[])
{
const struct command_s *c;

for(c = nrf51_read_cmd_list; c->cmd; c++) {
/* Accept a partial match as GDB does.
* So 'mon ver' will match 'monitor version'
*/
if(!strncmp(argv[1], c->cmd, strlen(argv[1])))
return !c->handler(t, argc - 1, &argv[1]);
if (argc > 1) {
for(c = nrf51_read_cmd_list; c->cmd; c++) {
/* Accept a partial match as GDB does.
* So 'mon ver' will match 'monitor version'
*/
if(!strncmp(argv[1], c->cmd, strlen(argv[1])))
return !c->handler(t, argc - 1, &argv[1]);
}
}

return nrf51_cmd_read_help(t);
}

Expand Down

0 comments on commit d164cf8

Please sign in to comment.