From faf47b94e24314d74907f3f6bc874105f2c962ed Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 26 Sep 2018 03:31:05 +0800 Subject: Throw when page number is out of range. Other code depends on this and does not handle a page pointer being NULL well. --- source/cbz/mucbz.c | 2 +- source/cbz/muimg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source/cbz') diff --git a/source/cbz/mucbz.c b/source/cbz/mucbz.c index 5cbdf0ca..3aef043e 100644 --- a/source/cbz/mucbz.c +++ b/source/cbz/mucbz.c @@ -181,7 +181,7 @@ cbz_load_page(fz_context *ctx, fz_document *doc_, int number) fz_buffer *buf = NULL; if (number < 0 || number >= doc->page_count) - return NULL; + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load page %d", number); fz_var(page); diff --git a/source/cbz/muimg.c b/source/cbz/muimg.c index b54371fa..fb075307 100644 --- a/source/cbz/muimg.c +++ b/source/cbz/muimg.c @@ -82,7 +82,7 @@ img_load_page(fz_context *ctx, fz_document *doc_, int number) img_page *page = NULL; if (number < 0 || number >= doc->page_count) - return NULL; + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load page %d", number); fz_var(pixmap); fz_var(image); -- cgit v1.2.3