diff options
Diffstat (limited to 'platform/java/mupdf_native.c')
-rw-r--r-- | platform/java/mupdf_native.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index b2ec3eb1..3f211d78 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -251,8 +251,11 @@ static void fz_throw_java(fz_context *ctx, JNIEnv *env) jthrowable ex = (*env)->ExceptionOccurred(env); if (ex) { + (*env)->ExceptionClear(env); jobject msg = (*env)->CallObjectMethod(env, ex, mid_Object_toString); - if (!(*env)->ExceptionCheck(env) && msg) + if ((*env)->ExceptionCheck(env)) + (*env)->ExceptionClear(env); + else if (msg) { const char *p = (*env)->GetStringUTFChars(env, msg, NULL); if (p) |