couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [4/7] git commit: add guards for when module isn't defined, as is the case in contribute addon
Date Mon, 25 Feb 2013 03:34:35 GMT
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/b969ddf0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b969ddf0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b969ddf0

Branch: refs/heads/fauxton
Commit: b969ddf0e924c9419eddc5cd297709e3774a78ec
Parents: ff4140f
Author: Simon Metson <simon+github@cloudant.com>
Authored: Tue Feb 12 11:15:22 2013 +0000
Committer: Simon Metson <simon+github@cloudant.com>
Committed: Wed Feb 13 10:54:37 2013 +0000

----------------------------------------------------------------------
 src/fauxton/app/router.js |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b969ddf0/src/fauxton/app/router.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/router.js b/src/fauxton/app/router.js
index 3b74afc..94b72f6 100644
--- a/src/fauxton/app/router.js
+++ b/src/fauxton/app/router.js
@@ -107,10 +107,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);
     },
@@ -118,7 +120,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);


Mime
View raw message