commit 2651f32f7db462d8bc26966ec962db6ca5d3ec5b
parent f59a48da7d6b9fa862e835dafdd5e55138ea6bff
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date: Tue, 11 Feb 2020 19:42:30 +0100
fix segfault. prevent from bottom from being NULL
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/scroll.c b/scroll.c
@@ -181,6 +181,9 @@ scrollup(void)
for (rows = 0; bottom != NULL && rows < 2 * ws.ws_row; rows++)
bottom = TAILQ_NEXT(bottom, entries);
+ if (bottom == NULL)
+ bottom = TAILQ_LAST(&head, tailhead);
+
/* print one page */
for (; rows > ws.ws_row - first;) {
if ((bottom = TAILQ_PREV(bottom, tailhead, entries)) == NULL)