summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/listbox.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/listbox.c b/src/listbox.c
index 5cdc9a1..853dc03 100644
--- a/src/listbox.c
+++ b/src/listbox.c
@@ -88,6 +88,9 @@ void listbox_load_items(struct listbox *lb, int item_count)
lb->item_count = item_count;
+ if (item_count > 0 && lb->item_sel < 0)
+ lb->item_sel = 0;
+
if (lb->item_sel >= item_count)
lb->item_sel = item_count - 1;