summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-01-05 16:42:18 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-01-09 17:45:35 +0100
commit5d92615f37303041a473e8a25860860601a8dcfe (patch)
tree64aa822998491d5ef9e0fd31d3d67556c35069bd
parent9d68b4ac70ca617dd5c9b70a8a3a80192119518e (diff)
downloadmupdf-5d92615f37303041a473e8a25860860601a8dcfe.tar.xz
java: Handle outlines with duff links.
-rw-r--r--platform/java/mupdf_native.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index 90ced34e..c6582d25 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -961,7 +961,7 @@ static inline jobject to_Outline_safe(fz_context *ctx, JNIEnv *env, fz_document
while (outline)
{
jstring jtitle = NULL;
- jint jpage = 0;
+ jint jpage = -1;
jstring juri = NULL;
jobject jdown = NULL;
@@ -971,13 +971,16 @@ static inline jobject to_Outline_safe(fz_context *ctx, JNIEnv *env, fz_document
if (!jtitle) return NULL;
}
- if (fz_is_external_link(ctx, outline->uri))
+ if (outline->uri)
{
- juri = (*env)->NewStringUTF(env, outline->uri);
- if (!juri) return NULL;
+ if (fz_is_external_link(ctx, outline->uri))
+ {
+ juri = (*env)->NewStringUTF(env, outline->uri);
+ if (!juri) return NULL;
+ }
+ else
+ jpage = fz_resolve_link(ctx, doc, outline->uri, NULL, NULL);
}
- else
- jpage = fz_resolve_link(ctx, doc, outline->uri, NULL, NULL);
if (outline->down)
{