From 5a1f642ce29754ff5f9132f1c84113cc84db6db5 Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 24 Apr 2020 11:23:03 -0600 Subject: [PATCH] Make sure there are no parameters before trying nice check for function name --- .../etemplate/et2_core_legacyJSFunctions.js | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/api/js/etemplate/et2_core_legacyJSFunctions.js b/api/js/etemplate/et2_core_legacyJSFunctions.js index d08077ff5e..37e82336a2 100644 --- a/api/js/etemplate/et2_core_legacyJSFunctions.js +++ b/api/js/etemplate/et2_core_legacyJSFunctions.js @@ -125,25 +125,24 @@ // Check to see if it's referring to an existing function with no arguments specified. // If so, bind context & use it directly - var parts = _code.split("."); - var existing_func = parts.pop(); - var parent = _widget.egw().window; - for(var i=0; i < parts.length; ++i) + if(_code.indexOf("(") === -1) { - if (typeof parent[parts[i]] !== "undefined") - { - parent = parent[parts[i]]; + var parts = _code.split("."); + var existing_func = parts.pop(); + var parent = _widget.egw().window; + for (var i = 0; i < parts.length; ++i) { + if (typeof parent[parts[i]] !== "undefined") { + parent = parent[parts[i]]; + } + // Nope + else { + break; + } } - // Nope - else - { - break; + if (typeof parent[existing_func] === "function") { + return parent[existing_func].bind(context); } } - if (typeof parent[existing_func] === "function") - { - return parent[existing_func].bind(context); - } // Generate the function itself, if it fails, log the error message and // return a function which always returns false