From 0a3a970b5293f654f9590f460a6c08667477cb2e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 29 Jul 2013 15:14:41 -0400 Subject: [PATCH] fixed issue where if a hook had no attached methods, it wouldn't work at all... or put simply... nodebb'd break if you had no plugins, heh. --- src/plugins.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins.js b/src/plugins.js index cc52ffa017..829bb7412f 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -74,7 +74,7 @@ var fs = require('fs'), var _self = this hookList = this.loadedHooks[hook]; - if(hookList && Array.isArray(hookList)) { + if (hookList && Array.isArray(hookList)) { if (global.env === 'development') console.log('Info: [plugins] Firing hook: \'' + hook + '\''); var hookType = hook.split(':')[0]; switch(hookType) { @@ -109,6 +109,10 @@ var fs = require('fs'), // Do nothing... break; } + } else { + // Otherwise, this hook contains no methods + var returnVal = (Array.isArray(args) ? args[0] : args); + if (callback) callback(returnVal); } }, showInstalled: function() {