Преглед на файлове

prevent bottom from getting NULL again in scrolldown

Jan Klemkow преди 6 години
родител
ревизия
7e05ee7852
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  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" */