aboutsummaryrefslogtreecommitdiffstats
path: root/src/list_window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/list_window.c')
-rw-r--r--src/list_window.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/list_window.c b/src/list_window.c
index efb610117..9f34f539f 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -73,7 +73,9 @@ list_window_check_selected(struct list_window *lw, unsigned length)
if (lw->selected < lw->start)
lw->selected = lw->start;
- if (length > 0 && lw->selected >= length)
+ if (length == 0)
+ lw->selected = 0;
+ else if (lw->selected >= length)
lw->selected = length - 1;
}