diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2018-11-05 16:47:59 +0100 |
---|---|---|
committer | Łukasz Paczos <lukas.paczos@gmail.com> | 2018-11-05 20:14:45 +0100 |
commit | 43dba7441ad8920c9974d8f11720c0e1dcb60a4b (patch) | |
tree | bae61900fc81214215bb93de298b3f3e41b18f81 | |
parent | cbe14aeadbe341bdffd86e3ec658473091eb893d (diff) | |
download | qtlocation-mapboxgl-upstream/lp-backport-13278-horchata.tar.gz |
[android] null-check nativeMapView in case it's destroyedupstream/lp-backport-13278-horchata
(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); } } |