Studio: cleanup 'null'-layers before generating errors

This commit is contained in:
Pieter Vander Vennet 2024-04-27 23:43:39 +02:00
parent d2e7bac775
commit 181965efd9
2 changed files with 11 additions and 0 deletions

View file

@ -508,6 +508,9 @@ export class EditThemeState extends EditJsonState<LayoutConfigJson> {
}
const prepare = this.buildValidation(state)
const context = ConversionContext.construct([], ["prepare"])
if(configuration.layers){
Utils.NoNullInplace(configuration.layers)
}
try {
prepare.convert(<LayoutConfigJson>configuration, context)
} catch (e) {

View file

@ -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)
}
}
}
}