diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-03-21 16:50:52 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-03-21 17:00:31 +0000 |
commit | c373cc8e44b0b32220088059ada161edfd0a2d78 (patch) | |
tree | 77f89488827327b4fe2a12329b0b39f7214cd161 /android/jni | |
parent | 6f1a3ce9dd2821042b146fb928c215b2d0549a3e (diff) | |
download | mupdf-c373cc8e44b0b32220088059ada161edfd0a2d78.tar.xz |
Bug 693719: Android: Catch exceptions when counting pages.
Return 0. Check for this case when opening a PDF and give a nice dialogue.
Fix the nice dialogue code so that it doesn't crash afterwards due to
a null mSearchTask.
Diffstat (limited to 'android/jni')
-rw-r--r-- | android/jni/mupdf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c index 74d9970d..c929e13e 100644 --- a/android/jni/mupdf.c +++ b/android/jni/mupdf.c @@ -447,8 +447,18 @@ JNIEXPORT int JNICALL JNI_FN(MuPDFCore_countPagesInternal)(JNIEnv *env, jobject thiz) { globals *glo = get_globals(env, thiz); + fz_context *ctx = glo->ctx; + int count = 0; - return fz_count_pages(glo->doc); + fz_try(ctx) + { + count = fz_count_pages(glo->doc); + } + fz_catch(ctx) + { + LOGE("exception while counting pages: %s", ctx->error->message); + } + return count; } JNIEXPORT void JNICALL |