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.
v1.18.x
Julian Lam 10 years ago
parent 6348eb2bab
commit 03b6b1e15c

@ -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

Loading…
Cancel
Save