Browse Source

fix segfault. prevent from bottom from being NULL

Jan Klemkow 6 years ago
parent
commit
2651f32f7d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      scroll.c

+ 3 - 0
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)