Update os/services/shell/shell-commands.c

Co-Authored-By: joakimeriksson <joakime@sics.se>
This commit is contained in:
Niclas Finne 2018-11-02 15:20:07 +01:00 committed by GitHub
parent ef9b1f32ba
commit 93c7aae49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -781,7 +781,9 @@ PT_THREAD(cmd_llsec_setkey(struct pt *pt, shell_output_func output, char *args))
#if MAC_CONF_WITH_CSMA
/* Get next arg (key-string) */
SHELL_ARGS_NEXT(args, next_args);
if(args != NULL && strlen(args) == 16) {
if(args == NULL) {
SHELL_OUTPUT(output, "Provide both an index and a key\n");
} else if(strlen(args) == 16) {
csma_security_set_key(key, (const uint8_t *) args);
SHELL_OUTPUT(output, "Set key for index %d\n", key);
} else {