diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-11-06 11:48:29 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-11-07 10:34:01 +0100 |
commit | f560b4f9efebb4d448181724304f63b683a26b67 (patch) | |
tree | 6826da3766251e4acc942ba3237773c8c9982ea4 /platform | |
parent | f2d9d92d26e0476adaf3e4263b77bfb8f38d6d35 (diff) | |
download | qtlocation-mapboxgl-f560b4f9efebb4d448181724304f63b683a26b67.tar.gz |
[android] - handle null getMapAsync invocations, deliver onMapReady only once
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 10 |
1 files changed, 8 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 20bb49f140..d6dcce434d 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 @@ -1149,13 +1149,18 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { } } + /** + * Notify listeners, clear when done + */ private void onMapReady() { if (onMapReadyCallbackList.size() > 0) { - // Notify listeners, clear when done Iterator<OnMapReadyCallback> iterator = onMapReadyCallbackList.iterator(); while (iterator.hasNext()) { OnMapReadyCallback callback = iterator.next(); - callback.onMapReady(mapboxMap); + if (callback != null) { + // null checking required for #13279 + callback.onMapReady(mapboxMap); + } iterator.remove(); } } @@ -1190,6 +1195,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { public void onDidFinishLoadingStyle() { if (mapboxMap != null) { if (initialLoad) { + initialLoad = false; mapboxMap.onPreMapReady(); onMapReady(); mapboxMap.onPostMapReady(); |