From 90269f9a74af33f980f8ff055145a320e92608e9 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 28 Nov 2012 17:25:10 +0000 Subject: Avoid calling interactive functions with a NULL idoc. This solves the android build SEGVing on xps files such as ECMA-288.xps. --- android/jni/mupdf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'android/jni') diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c index 91953bcc..29942f3a 100644 --- a/android/jni/mupdf.c +++ b/android/jni/mupdf.c @@ -450,7 +450,8 @@ Java_com_artifex_mupdf_MuPDFCore_drawPage(JNIEnv *env, jobject thiz, jobject bit // Call fz_update_page now to ensure future calls yield the // changes from the current state - fz_update_page(idoc, pc->page); + if (idoc) + fz_update_page(idoc, pc->page); if (hq) { // This is a rendering of the hq patch. Ensure there's a second copy of the @@ -626,7 +627,8 @@ Java_com_artifex_mupdf_MuPDFCore_updatePageInternal(JNIEnv *env, jobject thiz, j // must use the correct one for calculating updates fz_page *page = hq ? pc->hq_page : pc->page; - fz_update_page(idoc, page); + if (idoc) + fz_update_page(idoc, page); if (pc->page_list == NULL) { @@ -664,7 +666,7 @@ Java_com_artifex_mupdf_MuPDFCore_updatePageInternal(JNIEnv *env, jobject thiz, j bbox = fz_round_rect(fz_transform_rect(ctm, pc->media_box)); LOGI("Start polling for updates"); - while ((annot = fz_poll_changed_annot(idoc, page)) != NULL) + while (idoc && (annot = fz_poll_changed_annot(idoc, page)) != NULL) { fz_bbox abox = fz_round_rect(fz_transform_rect(ctm, fz_bound_annot(doc, annot))); abox = fz_intersect_bbox(abox, rect); -- cgit v1.2.3