Skip to content

Commit 58f0098

Browse files
committed
maybe fix a crash in fz_load_chapter_page
1 parent df49763 commit 58f0098

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mupdf/source/fitz/document.c

+5
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,11 @@ fz_load_chapter_page(fz_context *ctx, fz_document *doc, int chapter, int number)
581581
/* Protect modifications to the page list to cope with
582582
* destruction of pages on other threads. */
583583
fz_lock(ctx, FZ_LOCK_ALLOC);
584+
/* SumatraPDF: seen a crash */
585+
if (doc == NULL) {
586+
fz_unlock(ctx, FZ_LOCK_ALLOC);
587+
return NULL;
588+
}
584589
for (page = doc->open; page; page = page->next)
585590
if (page->chapter == chapter && page->number == number)
586591
{

0 commit comments

Comments
 (0)