diff options
Diffstat (limited to 'platform')
2 files changed, 12 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java index f1e057f060..17670abd09 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java @@ -165,7 +165,9 @@ public final class MapFragment extends Fragment implements OnMapReadyCallback { @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - map.onSaveInstanceState(outState); + if (map != null && !map.isDestroyed()) { + map.onSaveInstanceState(outState); + } } /** @@ -183,7 +185,9 @@ public final class MapFragment extends Fragment implements OnMapReadyCallback { @Override public void onLowMemory() { super.onLowMemory(); - map.onLowMemory(); + if (map != null && !map.isDestroyed()) { + map.onLowMemory(); + } } /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java index 005e8b19d2..590851d354 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java @@ -160,7 +160,9 @@ public class SupportMapFragment extends Fragment implements OnMapReadyCallback { @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - map.onSaveInstanceState(outState); + if (map != null && !map.isDestroyed()) { + map.onSaveInstanceState(outState); + } } /** @@ -178,7 +180,9 @@ public class SupportMapFragment extends Fragment implements OnMapReadyCallback { @Override public void onLowMemory() { super.onLowMemory(); - map.onLowMemory(); + if (map != null && !map.isDestroyed()) { + map.onLowMemory(); + } } /** |