From 79f918eb8fe6a533191ad31b29b14bf382ffd1e4 Mon Sep 17 00:00:00 2001 From: Antonio Zugaldia Date: Fri, 19 Feb 2016 11:42:03 -0500 Subject: [PATCH] [android] #3891 - add ExceptionCheck --- platform/android/src/jni.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index b2ae73fdb3f..c1688dee524 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -1738,9 +1738,14 @@ void JNICALL createOfflineRegion(JNIEnv *env, jobject obj, jlong defaultFileSour jobject jRegion = env->NewObject(offlineRegionClass, offlineRegionConstructorId, region->getID()); // env->SetLongField(jRegion, offlineRegionIdId, region->getID()); - // This currently causes an exception on Android - mbgl::Log::Error(mbgl::Event::JNI, "Triggering Java callback."); - env->CallVoidMethod(createCallback, createOnCreateMethodId, jRegion); + if (env->ExceptionCheck()) { + mbgl::Log::Error(mbgl::Event::JNI, "Exception."); + env->ExceptionDescribe(); + } else { + // This currently causes an exception on Android + mbgl::Log::Error(mbgl::Event::JNI, "Triggering Java callback."); + env->CallVoidMethod(createCallback, createOnCreateMethodId, jRegion); + } } // Detach when we're done