summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-widgets.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-11-17 19:35:49 +1100
committerJeremy Kerr <jk@ozlabs.org>2013-11-22 10:45:54 +0800
commit2af53a5c31a1b0c64bdfd4d115b42238a52c3af1 (patch)
treee5941c7d5ef2a99580b4ed672e4a2cff4dd9d5d6 /ui/ncurses/nc-widgets.c
parentf92de1b28bdee6b9480241b80856532e354cba6a (diff)
downloadtalos-petitboot-2af53a5c31a1b0c64bdfd4d115b42238a52c3af1.tar.gz
talos-petitboot-2af53a5c31a1b0c64bdfd4d115b42238a52c3af1.zip
ui/ncurses/widgets: Add n_options check to widget_select_get_value
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-widgets.c')
-rw-r--r--ui/ncurses/nc-widgets.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ui/ncurses/nc-widgets.c b/ui/ncurses/nc-widgets.c
index 98ea6be..d96480e 100644
--- a/ui/ncurses/nc-widgets.c
+++ b/ui/ncurses/nc-widgets.c
@@ -493,6 +493,8 @@ void widget_select_add_option(struct nc_widget_select *select, int value,
int widget_select_get_value(struct nc_widget_select *select)
{
+ if (!select->n_options)
+ return -1;
return select->options[select->selected_option].val;
}
OpenPOWER on IntegriCloud