From cfb0eb84e2040814aadfa8067dadfb6cd4dc74da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 9 Mar 2018 19:12:26 +0100 Subject: [PATCH] Make sure that "method" is a function It could be null or anything else really, so better be safe than sorry ;) See comments in ntoff/OctoPrint-Estop#4 --- src/octoprint/static/js/app/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/helpers.js b/src/octoprint/static/js/app/helpers.js index ae91ade7a..0781c9b6f 100644 --- a/src/octoprint/static/js/app/helpers.js +++ b/src/octoprint/static/js/app/helpers.js @@ -1051,7 +1051,7 @@ function callViewModelIf(viewModel, method, condition, callback, raiseErrors) { condition = function() { return true; }; } - if (!viewModel.hasOwnProperty(method) || !condition(viewModel, method)) return; + if (!viewModel.hasOwnProperty(method) || !_.isFunction(viewModel[method]) || !condition(viewModel, method)) return; var parameters = undefined; if (!_.isFunction(callback)) {