Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3891 - add ExceptionCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
zugaldia committed Feb 19, 2016
1 parent 1d4aa71 commit 79f918e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions platform/android/src/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 79f918e

Please sign in to comment.