Prevent exception SymbolLocationLayerRenderer with new style (#3369)

This commit is contained in:
Bart Louwers
2025-04-09 18:39:04 +02:00
committed by GitHub
parent 802586ed52
commit cb17b10824
2 changed files with 6 additions and 0 deletions

View File

@@ -319,6 +319,11 @@ final class SymbolLocationLayerRenderer implements LocationLayerRenderer {
}
private void refreshSource() {
// prevents exception when other style has been set with an update in flight
// https://github.com/maplibre/maplibre-native/issues/3348
if (!style.isFullyLoaded()) {
return;
}
GeoJsonSource source = style.getSourceAs(LOCATION_SOURCE);
if (source != null) {
locationSource.setGeoJson(locationFeature);

View File

@@ -966,6 +966,7 @@ class LocationLayerControllerTest {
val locationSource = Mockito.mock(GeoJsonSource::class.java)
Mockito.`when`<Any?>(style.getSourceAs(LocationComponentConstants.LOCATION_SOURCE))
.thenReturn(locationSource)
Mockito.`when`(style.isFullyLoaded).thenReturn(true)
val sourceProvider = buildLayerProvider()
Mockito.`when`(
sourceProvider.generateSource(