From 1365cc1ecc838828f0291beb0c7fb03535518469 Mon Sep 17 00:00:00 2001 From: Rene Kita Date: Tue, 28 Dec 2021 16:22:51 +0100 Subject: [PATCH] Check for NULL before dereferencing a pointer l is part of the exit condition of the while loop. If we exit the loop because l is NULL, we cannot dereference it. --- file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/file.c b/file.c index 964d1f4..a8f2fc6 100644 --- a/file.c +++ b/file.c @@ -8139,7 +8139,8 @@ getNextPage(Buffer *buf, int plen) l = l->next; } while (l && l->bpos); buf->firstLine = l; - buf->firstLine->prev = NULL; + if (l) + buf->firstLine->prev = NULL; } } pager_end: