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

Commit

Permalink
[android] - check for NULL java peer when attempting to invoke callback
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Mar 1, 2018
1 parent d5829d0 commit 1454c26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions platform/android/src/native_map_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ void NativeMapView::notifyMapChange(mbgl::MapChange change) {

android::UniqueEnv _env = android::AttachEnv();
static auto onMapChanged = javaClass.GetMethod<void (int)>(*_env, "onMapChanged");
javaPeer->Call(*_env, onMapChanged, (int) change);
if (javaPeer != NULL) {
javaPeer->Call(*_env, onMapChanged, (int) change);
}
}

void NativeMapView::onCameraWillChange(MapObserver::CameraChangeMode mode) {
Expand Down Expand Up @@ -408,7 +410,9 @@ void NativeMapView::scheduleSnapshot(jni::JNIEnv&) {

// invoke Mapview#OnSnapshotReady
static auto onSnapshotReady = javaClass.GetMethod<void (jni::Object<Bitmap>)>(*_env, "onSnapshotReady");
javaPeer->Call(*_env, onSnapshotReady, bitmap);
if (javaPeer != NULL) {
javaPeer->Call(*_env, onSnapshotReady, bitmap);
}
});
}

Expand Down

0 comments on commit 1454c26

Please sign in to comment.