shell: improve function shell_cmd_get
The function can return existing root command even if dloc argument is a NULL pointer. Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
This commit is contained in:
parent
ee2c66a627
commit
0cf6670b70
1 changed files with 2 additions and 1 deletions
|
@ -248,7 +248,6 @@ const struct shell_static_entry *shell_cmd_get(
|
||||||
size_t idx,
|
size_t idx,
|
||||||
struct shell_static_entry *dloc)
|
struct shell_static_entry *dloc)
|
||||||
{
|
{
|
||||||
__ASSERT_NO_MSG(dloc != NULL);
|
|
||||||
const struct shell_static_entry *res = NULL;
|
const struct shell_static_entry *res = NULL;
|
||||||
|
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
|
@ -256,6 +255,8 @@ const struct shell_static_entry *shell_cmd_get(
|
||||||
shell_root_cmd_get(idx)->u.entry : NULL;
|
shell_root_cmd_get(idx)->u.entry : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__ASSERT_NO_MSG(dloc != NULL);
|
||||||
|
|
||||||
if (parent->subcmd) {
|
if (parent->subcmd) {
|
||||||
if (parent->subcmd->is_dynamic) {
|
if (parent->subcmd->is_dynamic) {
|
||||||
parent->subcmd->u.dynamic_get(idx, dloc);
|
parent->subcmd->u.dynamic_get(idx, dloc);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue