diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-08-07 13:05:37 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-08-07 13:07:31 +0800 |
commit | 9110e5d8f5ed4945c416ce6732f86bd16284d7ea (patch) | |
tree | df1dd5f1ad35a3080270e391b36e567e916d61ee | |
parent | 6372d8c0a92da39399a4aa0e4c0833611e4a249f (diff) | |
download | mupdf-9110e5d8f5ed4945c416ce6732f86bd16284d7ea.tar.xz |
JNI: Only store links/annotations if all are successfully handled.
-rw-r--r-- | platform/java/mupdf_native.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index f4cf19b8..e943ac2c 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -4194,7 +4194,6 @@ FUN(Page_getAnnotations)(JNIEnv *env, jobject self) jannots = (*env)->NewObjectArray(env, annot_count, cls_Annot, NULL); if (jannots == NULL) fz_throw(ctx, FZ_ERROR_GENERIC, "getAnnotations failed (1)"); - (*env)->SetObjectField(env, self, fid_Page_nativeAnnots, jannots); /* Now run through actually creating the annotation objects */ annot = annots; @@ -4207,6 +4206,8 @@ FUN(Page_getAnnotations)(JNIEnv *env, jobject self) } if (annot != NULL || i != annot_count) fz_throw(ctx, FZ_ERROR_GENERIC, "getAnnotations failed (4)"); + + (*env)->SetObjectField(env, self, fid_Page_nativeAnnots, jannots); } fz_catch(ctx) { @@ -4256,7 +4257,6 @@ FUN(Page_getLinks)(JNIEnv *env, jobject self) jlinks = (*env)->NewObjectArray(env, link_count, cls_Link, NULL); if (jlinks == NULL) fz_throw(ctx, FZ_ERROR_GENERIC, "getLinks failed (1)"); - (*env)->SetObjectField(env, self, fid_Page_nativeLinks, jlinks); /* Now run through actually creating the link objects */ link = links; @@ -4290,6 +4290,8 @@ FUN(Page_getLinks)(JNIEnv *env, jobject self) } if (link != NULL || i != link_count) fz_throw(ctx, FZ_ERROR_GENERIC, "getLinks failed (3)"); + + (*env)->SetObjectField(env, self, fid_Page_nativeLinks, jlinks); } fz_always(ctx) fz_drop_link(ctx, links); |