Fixed crash on launch if no hooks listen to filter:router.page

A previous commit added a new hook, although it executed async.each on a var without a null check, so if no hooks were registered, it was null, and not an empty array, causing async to crash.
This commit is contained in:
Julian Lam
2015-07-28 10:36:51 -04:00
parent 6348eb2bab
commit 03b6b1e15c

View File

@@ -67,7 +67,7 @@ middleware.pageView = function(req, res, next) {
};
middleware.pluginHooks = function(req, res, next) {
async.each(plugins.loadedHooks['filter:router.page'], function(hookObj, next) {
async.each(plugins.loadedHooks['filter:router.page'] || [], function(hookObj, next) {
hookObj.method(req, res, next)
}, function(req, res) {
// If it got here, then none of the subscribed hooks did anything, or there were no hooks