summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
index 2391d6a86e..59ce2a900e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
@@ -854,7 +854,8 @@ public final class LocationComponent {
*/
public void onFinishLoadingStyle() {
if (isComponentInitialized) {
- locationLayerController.initializeComponents(options);
+ style = mapboxMap.getStyle();
+ locationLayerController.initializeComponents(style, options);
locationCameraController.initializeOptions(options);
onLocationLayerStart();
}
@@ -913,7 +914,10 @@ public final class LocationComponent {
if (isComponentInitialized) {
return;
}
- isComponentInitialized = true;
+
+ if (!style.isFullyLoaded()) {
+ throw new IllegalStateException("Style hasn't fully loaded yet, can't initialize LocationComponent.");
+ }
this.style = style;
this.options = options;
@@ -946,6 +950,8 @@ public final class LocationComponent {
setRenderMode(RenderMode.NORMAL);
setCameraMode(CameraMode.NONE);
+ isComponentInitialized = true;
+
onLocationLayerStart();
}