shell: Make bt_shell_add_submenu set main menu if none has been set

If not main menu has been set when calling bt_shell_add_submenu then
turns it on it main menu.
This commit is contained in:
Luiz Augusto von Dentz 2022-03-28 13:56:58 -07:00
parent 6cb6e2ddf4
commit 0cc480a546

View File

@ -1248,6 +1248,9 @@ bool bt_shell_add_submenu(const struct bt_shell_menu *menu)
if (!menu)
return false;
if (!data.main)
return bt_shell_set_menu(menu);
if (!data.submenus)
data.submenus = queue_new();