From 04feaff1d076a10ede1617a2844f8d13f0c3efa1 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 9 Sep 2022 08:34:41 -0600 Subject: [PATCH] Avoid parse error that breaks load if string is passed as an object property --- api/js/etemplate/Et2Widget/Et2Widget.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 819452a64f..5fbe51337d 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -1476,7 +1476,15 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes) else if(attrValue && [Object, Array].indexOf(typeof property === "object" ? property.type : property) != -1) { // Value was not supposed to be a string, but was run through here for expandName - attrValue = JSON.parse(attrValue); + try + { + attrValue = JSON.parse(attrValue); + } + catch(e) + { + console.info(widget_class.name + "#" + widget.id + " attribute '" + attribute + "' has type " + + (typeof property === "object" ? property.type.name : property.name) + " but value %o could not be parsed", attrValue); + } } break; }