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]); }