From 12d59bc238f08e42e652b775533430ad2a0bef2b Mon Sep 17 00:00:00 2001 From: Tiago R Date: Mon, 9 Oct 2023 13:17:48 +0000 Subject: [PATCH] fix crash with map Signed-off-by: GitHub --- backend/src/templateFormatter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/templateFormatter.ts b/backend/src/templateFormatter.ts index 31b71774..3f04fc76 100644 --- a/backend/src/templateFormatter.ts +++ b/backend/src/templateFormatter.ts @@ -538,6 +538,7 @@ const baseValues = { return math_constants[str.toLowerCase()] ?? ""; }, map(obj, key) { + if (typeof obj !== "object" || typeof key !== "string" || typeof obj === "function" || !obj) return ""; if (Array.isArray(obj)) { return obj.map((tobj) => tobj[key]); }