Browse Source

prevent bottom from getting NULL again in scrolldown

Jan Klemkow 6 years ago
parent
commit
7e05ee7852
1 changed files with 4 additions and 1 deletions
  1. 4 1
      scroll.c

+ 4 - 1
scroll.c

@@ -208,8 +208,11 @@ scrolldown(void)
 	write(STDOUT_FILENO, "\r\n", 2);
 	/* print one page */
 	for (; rows >= 0;) {
-		if ((bottom = TAILQ_PREV(bottom, tailhead, entries)) == NULL)
+		if (TAILQ_PREV(bottom, tailhead, entries) != NULL)
+			bottom = TAILQ_PREV(bottom, tailhead, entries);
+		else
 			break;
+
 		if (--rows > 0)
 			write(STDOUT_FILENO, bottom->buf, bottom->size);
 		else /* last line w/o "/r/n" */