summaryrefslogtreecommitdiff
path: root/android/jni
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-11-28 17:25:10 +0000
committerRobin Watts <robin.watts@artifex.com>2012-11-28 17:26:08 +0000
commit90269f9a74af33f980f8ff055145a320e92608e9 (patch)
tree0c52f3e138338bd526085a99b3b055788c1ddf02 /android/jni
parent6304d94bc99688a642cd0faf607a1843864b7cdf (diff)
downloadmupdf-90269f9a74af33f980f8ff055145a320e92608e9.tar.xz
Avoid calling interactive functions with a NULL idoc.
This solves the android build SEGVing on xps files such as ECMA-288.xps.
Diffstat (limited to 'android/jni')
-rw-r--r--android/jni/mupdf.c8
1 files changed, 5 insertions, 3 deletions
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);