summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/listbox.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/listbox.c b/src/listbox.c
index 245eeef..7f67fe4 100644
--- a/src/listbox.c
+++ b/src/listbox.c
@@ -64,6 +64,10 @@ void listbox_resize(struct listbox *lb, int y, int x, int h, int w)
{
EXIT_IF(lb == NULL, "null pointer");
wins_scrollwin_resize(&(lb->sw), y, x, h, w);
+
+ if (lb->item_sel < 0)
+ return;
+
wins_scrollwin_ensure_visible(&(lb->sw), lb->ch[lb->item_sel]);
wins_scrollwin_ensure_visible(&(lb->sw), lb->ch[lb->item_sel + 1] - 1);
}