From d16ed9024c4c9b6b70ee9b7cd4d4ccd5c0824e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Mon, 5 Nov 2018 16:47:59 +0100 Subject: [android] null-check nativeMapView in case it's destroyed --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 3d56e134f6..7cb8245301 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -505,7 +505,10 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { * @see Style */ public void setStyleUrl(@NonNull String url) { - nativeMapView.setStyleUrl(url); + if (nativeMapView != null) { + // null-checking the nativeMapView as it can be mistakenly called after it's been destroyed + nativeMapView.setStyleUrl(url); + } } /** @@ -541,7 +544,8 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { @Override protected void onSizeChanged(int width, int height, int oldw, int oldh) { - if (!isInEditMode()) { + if (!isInEditMode() && nativeMapView != null) { + // null-checking the nativeMapView, see #13277 nativeMapView.resizeView(width, height); } } -- cgit v1.2.1