diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-08-24 23:34:34 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-01 23:09:05 +0800 |
commit | 7b6bc6ed4513bf19f96968702eba926d820f46bc (patch) | |
tree | b9ef02c70b57a65dea296a7210e4779f7740ab64 | |
parent | 339fa94fa241b22c8e84a3d1e28879c0a07ee3cb (diff) | |
download | mupdf-7b6bc6ed4513bf19f96968702eba926d820f46bc.tar.xz |
JNI: Check for exceptions after calling method.
The return value from CallObjectMethod() is not valid if an exception
is thrown, so check for exceptions before looking at the return value.
Mentioned at http://developer.android.com/training/articles/perf-jni.html
-rw-r--r-- | platform/java/mupdf_native.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 860411e9..53d6d9ae 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -221,7 +221,7 @@ static void fz_throw_java(fz_context *ctx, JNIEnv *env) if (ex) { jobject msg = (*env)->CallObjectMethod(env, ex, mid_Object_toString); - if (msg) + if (!(*env)->ExceptionCheck(env) && msg) { const char *p = (*env)->GetStringUTFChars(env, msg, NULL); if (p) |