From 023c272cf4b605a8dc96d02100988f385fd98cb4 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Tue, 19 Jul 2016 03:27:08 +0800 Subject: 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. --- platform/java/mupdf_native.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'platform/java') 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; } -- cgit v1.2.3