add guards for when module isn't defined, as is the case in contribute addon
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/296a1503 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/296a1503 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/296a1503 Branch: refs/heads/fauxton-rebase Commit: 296a15033e26439d1cc5e30f28c5af436af6b3d8 Parents: 29f9122 Author: Simon Metson <[email protected]> Authored: Tue Feb 12 11:15:22 2013 +0000 Committer: Russell Branca <[email protected]> Committed: Fri Mar 15 14:35:40 2013 -0700 ---------------------------------------------------------------------- src/fauxton/app/router.js | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/296a1503/src/fauxton/app/router.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/router.js b/src/fauxton/app/router.js index dea55d5..58ab2cf 100644 --- a/src/fauxton/app/router.js +++ b/src/fauxton/app/router.js @@ -108,10 +108,12 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents } }, this); _.each(LoadAddons.addons, function(module) { - module.initialize(); - // This is pure routes the addon provides - if (module.Routes) { - _.each(module.Routes, this.addModuleRoute, this); + if (module){ + module.initialize(); + // This is pure routes the addon provides + if (module.Routes) { + _.each(module.Routes, this.addModuleRoute, this); + } } }, this); }, @@ -119,7 +121,7 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents setAddonHooks: function() { _.each(LoadAddons.addons, function(module) { // This is updates to views by the addon - if (module.hooks){ + if (module && module.hooks){ _.each(module.hooks, function(callback, route){ if (this.masterLayout.hooks[route]) { this.masterLayout.hooks[route].push(callback);
