From 1454c2600d56c9986e475517f8db0ddfe00abcf4 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Thu, 1 Mar 2018 20:57:00 +0100 Subject: [PATCH] [android] - check for NULL java peer when attempting to invoke callback --- platform/android/src/native_map_view.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 3bd46631a08..5bcde27d27d 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -104,7 +104,9 @@ void NativeMapView::notifyMapChange(mbgl::MapChange change) { android::UniqueEnv _env = android::AttachEnv(); static auto onMapChanged = javaClass.GetMethod(*_env, "onMapChanged"); - javaPeer->Call(*_env, onMapChanged, (int) change); + if (javaPeer != NULL) { + javaPeer->Call(*_env, onMapChanged, (int) change); + } } void NativeMapView::onCameraWillChange(MapObserver::CameraChangeMode mode) { @@ -408,7 +410,9 @@ void NativeMapView::scheduleSnapshot(jni::JNIEnv&) { // invoke Mapview#OnSnapshotReady static auto onSnapshotReady = javaClass.GetMethod)>(*_env, "onSnapshotReady"); - javaPeer->Call(*_env, onSnapshotReady, bitmap); + if (javaPeer != NULL) { + javaPeer->Call(*_env, onSnapshotReady, bitmap); + } }); }