diff --git a/src/UI/Studio/EditLayerState.ts b/src/UI/Studio/EditLayerState.ts index a3397c359c..1c5b1a7633 100644 --- a/src/UI/Studio/EditLayerState.ts +++ b/src/UI/Studio/EditLayerState.ts @@ -508,6 +508,9 @@ export class EditThemeState extends EditJsonState { } const prepare = this.buildValidation(state) const context = ConversionContext.construct([], ["prepare"]) + if(configuration.layers){ + Utils.NoNullInplace(configuration.layers) + } try { prepare.convert(configuration, context) } catch (e) { diff --git a/src/Utils.ts b/src/Utils.ts index 77062e583b..cc0d6a47db 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -1649,4 +1649,12 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be } return n + Utils._metrixPrefixes[index] } + + static NoNullInplace(layers: any[]):void { + for (let i = layers.length - 1; i >= 0; i--) { + if(layers[i] === null || layers[i] === undefined){ + layers.splice(i, 1) + } + } + } }