From af75a887b5a0ca007a7d802231654f0626cfec39 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 27 Jul 2016 22:17:02 +0300 Subject: [PATCH] closes #4892 prevent crash if registerHook is called with invalid hook name --- src/plugins/hooks.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js index c2dde7b92a..5bd2ba459e 100644 --- a/src/plugins/hooks.js +++ b/src/plugins/hooks.js @@ -23,6 +23,10 @@ module.exports = function(Plugins) { } } + if (!data.hook) { + return winston.warn('[plugins/' + id + '] registerHook called with invalid data.hook', data); + } + var method; if (Object.keys(Plugins.deprecatedHooks).indexOf(data.hook) !== -1) {