Skip to content

Commit c1a1688

Browse files
authored
fix(carto): VectorTileLayer guard against null layers (#9885)
1 parent 8f60761 commit c1a1688

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

modules/carto/src/layers/vector-tile-layer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export default class VectorTileLayer<
227227
}
228228

229229
// Sort layers so that label layers are rendered after the main layer
230-
const validLayers = layers.flat().filter(Boolean) as Layer[];
230+
const validLayers = (layers || []).flat().filter(Boolean) as Layer[];
231231
validLayers.sort((a: Layer, b: Layer) => {
232232
const aHasLabel = a.id.includes('labels');
233233
const bHasLabel = b.id.includes('labels');

0 commit comments

Comments
 (0)