diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-01-10 14:53:28 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-01-23 12:09:48 +0100 |
commit | b03c2263737a1a9277fd7f794e33571ef3f671fa (patch) | |
tree | d7217c10ac3df07cab5d255355853466e80d787f /platform/android/MapboxGLAndroidSDK/src/main/java/com | |
parent | 46ace8d2c7d71913c5703a30c777cefd9f714eed (diff) | |
download | qtlocation-mapboxgl-b03c2263737a1a9277fd7f794e33571ef3f671fa.tar.gz |
[android] - check if the render surface has been correctly created before destroying the map
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 4 |
1 files changed, 3 insertions, 1 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 d03882b5c7..c5b7159e8c 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 @@ -75,6 +75,7 @@ public class MapView extends FrameLayout { private NativeMapView nativeMapView; private MapboxMapOptions mapboxMapOptions; private boolean destroyed; + private boolean hasSurface; private MyLocationView myLocationView; private CompassView compassView; @@ -321,6 +322,7 @@ public class MapView extends FrameLayout { } private void initRenderSurface() { + hasSurface = true; post(new Runnable() { @Override public void run() { @@ -409,7 +411,7 @@ public class MapView extends FrameLayout { destroyed = true; mapCallback.clearOnMapReadyCallbacks(); - if (nativeMapView != null) { + if (nativeMapView != null && hasSurface) { // null when destroying an activity programmatically mapbox-navigation-android/issues/503 nativeMapView.destroy(); nativeMapView = null; |