menu: menu_get_choice() return -ENOENT if menu item is empty

menu_get_choice() needs to handle the case that menu item
is empty. In this case, menu_get_choice() returns -ENOENT.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Masahisa Kojima 2022-04-28 17:09:37 +09:00 committed by Heinrich Schuchardt
parent c23bb03465
commit 7f67525f99

View file

@ -271,6 +271,9 @@ int menu_get_choice(struct menu *m, void **choice)
if (!m || !choice)
return -EINVAL;
if (!m->item_cnt)
return -ENOENT;
if (!m->prompt)
return menu_default_choice(m, choice);