diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2018-11-05 16:47:59 +0100 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-11-06 11:25:47 +0100 |
commit | afe7e8df63d6f2d0f3418c5a0f44b4a039560566 (patch) | |
tree | bae61900fc81214215bb93de298b3f3e41b18f81 | |
parent | cbe14aeadbe341bdffd86e3ec658473091eb893d (diff) | |
download | qtlocation-mapboxgl-afe7e8df63d6f2d0f3418c5a0f44b4a039560566.tar.gz |
[android] null-check nativeMapView in case it's destroyed
(cherry picked from commit 68fd3a2)
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 8 |
1 files 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 29648ddbe2..0a5e2455e1 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 @@ -548,7 +548,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); + } } /** @@ -606,7 +609,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); } } |