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-05 18:08:31 +0100 |
commit | 68fd3a28225cccf9f1564af9dec0151f13cc8700 (patch) | |
tree | d53147b40153fc3c9a0e9b910e34978f6b6dd139 | |
parent | 18b00b95e9eaaa00e1fe0445d907570710f67df6 (diff) | |
download | qtlocation-mapboxgl-68fd3a28225cccf9f1564af9dec0151f13cc8700.tar.gz |
[android] null-check nativeMapView in case it's destroyed
-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 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); } } |