Fixed label template error if invalid extra field

This commit is contained in:
Donkie
2024-08-07 14:26:03 +02:00
parent 10ad8cebcb
commit ae26bf5733

View File

@@ -60,7 +60,11 @@ function getTagValue(tag: string, obj: GenericObject): any {
// Split tag by .
const tagParts = tag.split(".");
if (tagParts[0] === "extra") {
return JSON.parse(obj.extra[tagParts[1]]);
const extraValue = obj.extra[tagParts[1]];
if (extraValue === undefined) {
return "?";
}
return JSON.parse(extraValue);
}
const value = obj[tagParts[0]] ?? "?";