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.
This commit is contained in:
Rene Kita
2021-12-28 16:22:51 +01:00
parent 6432709b80
commit 1365cc1ecc
+1
View File
@@ -8139,6 +8139,7 @@ getNextPage(Buffer *buf, int plen)
l = l->next; l = l->next;
} while (l && l->bpos); } while (l && l->bpos);
buf->firstLine = l; buf->firstLine = l;
if (l)
buf->firstLine->prev = NULL; buf->firstLine->prev = NULL;
} }
} }