From f5c644cbe156573d23824a5c7046d1dec93eaf58 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 30 Mar 2012 17:57:52 +0100 Subject: [PATCH] [menu] Fix default selection when default is item 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-by: Robin Smidsrød Signed-off-by: Michael Brown --- src/hci/tui/menu_ui.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c index 6b1b6323..2457a825 100644 --- a/src/hci/tui/menu_ui.c +++ b/src/hci/tui/menu_ui.c @@ -315,9 +315,9 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms, ui.timeout = ( ( timeout_ms * TICKS_PER_SEC ) / 1000 ); list_for_each_entry ( item, &menu->items, list ) { if ( item->label ) { - labelled_count++; - if ( ! ui.selected ) + if ( ! labelled_count ) ui.selected = ui.count; + labelled_count++; if ( item->is_default ) ui.selected = ui.count; }