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
This commit is contained in:
Gina Häußge committed 2018-03-09 19:12:26 +01:00
1 parent effefffe74
commit cfb0eb84e2
1 file changed
+1 -1
+1 -1
View File
@@ -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)) {