diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-07-19 03:27:08 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-07-19 03:31:17 +0800 |
commit | 023c272cf4b605a8dc96d02100988f385fd98cb4 (patch) | |
tree | d110c0dcd6ada4312aca0ca904a84788a89609b3 | |
parent | de0346599c01866ef45e7e984232d1079352ef88 (diff) | |
download | mupdf-023c272cf4b605a8dc96d02100988f385fd98cb4.tar.xz |
JNI: Fix bug in Document.loadOutline.
Previously an exception was thrown for documents without an outline.
Now document both with and without an outline are handled correctly.
-rw-r--r-- | platform/java/mupdf_native.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 7e8fa66f..fd53b019 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -3863,14 +3863,18 @@ FUN(Document_loadOutline)(JNIEnv *env, jobject self) fz_try(ctx) outline = fz_load_outline(ctx, doc); fz_catch(ctx) + { jni_rethrow(env, ctx); + return NULL; + } - joutline = to_Outline_safe(ctx, env, outline); - if (joutline == NULL) + if (outline != NULL) { - jni_throw(env, FZ_ERROR_GENERIC, "loadOutline failed"); + joutline = to_Outline_safe(ctx, env, outline); + if (joutline == NULL) + jni_throw(env, FZ_ERROR_GENERIC, "loadOutline failed"); + fz_drop_outline(ctx, outline); } - fz_drop_outline(ctx, outline); return joutline; } |