console: handle empty input to esp_console_run correctly

Fixes https://github.com/espressif/esp-idf/issues/1067

Ref. TW15752
This commit is contained in:
Ivan Grokhotkov
2017-10-13 07:12:08 +08:00
parent 8e47c355fa
commit 4d42b5ea24
3 changed files with 7 additions and 1 deletions

View File

@@ -185,7 +185,9 @@ esp_err_t esp_console_run(const char* cmdline, int* cmd_ret)
size_t argc = esp_console_split_argv(s_tmp_line_buf, argv,
s_config.max_cmdline_args);
if (argc == 0) {
return ESP_ERR_INVALID_ARG;
}
const cmd_item_t* cmd = find_command_by_name(argv[0]);
if (cmd == NULL) {
return ESP_ERR_NOT_FOUND;