浏览代码

fix segfault. prevent from bottom from being NULL

Jan Klemkow 6 年之前
父节点
当前提交
2651f32f7d
共有 1 个文件被更改,包括 3 次插入0 次删除
  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)