From 202e3cd677943bdd5e7daaee0889ade38fab8e78 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Fri, 17 Sep 2021 16:54:12 +0200 Subject: [PATCH] Fix canonicalization if no units are given --- Logic/SimpleMetaTagger.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Logic/SimpleMetaTagger.ts b/Logic/SimpleMetaTagger.ts index 27f4225b9..7440a067a 100644 --- a/Logic/SimpleMetaTagger.ts +++ b/Logic/SimpleMetaTagger.ts @@ -83,13 +83,20 @@ export default class SimpleMetaTagger { }, (feature => { - const units = Utils.NoNull([].concat(State.state?.layoutToUse?.data?.layers?.map(layer => layer.units ?? []))); + const units = Utils.NoNull([].concat(...State.state?.layoutToUse?.data?.layers?.map(layer => layer.units ?? []))); + if(units.length == 0){ + return; + } let rewritten = false; for (const key in feature.properties) { if (!feature.properties.hasOwnProperty(key)) { continue; } for (const unit of units) { + if(unit.appliesToKeys === undefined){ + console.error("The unit ", unit, "has no appliesToKey defined") + continue + } if (!unit.appliesToKeys.has(key)) { continue; }