Log failures to match a route for the initial path
authorTom Hughes <tom@compton.nu>
Tue, 3 Dec 2013 17:51:01 +0000 (17:51 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 3 Dec 2013 17:51:01 +0000 (17:51 +0000)
app/assets/javascripts/router.js

index cadb6b628f1b672fa9dd46aaa6a2adf5279ddca1..0d57b80d488c3d56e291272b2ba9070ac0bd5508 100644 (file)
@@ -169,8 +169,12 @@ OSM.Router = function(map, rts) {
   };
 
   router.load = function() {
-    var loadState = currentRoute.run('load', currentPath);
-    router.stateChange(loadState || {});
+    if (currentRoute) {
+      var loadState = currentRoute.run('load', currentPath);
+      router.stateChange(loadState || {});
+    } else {
+      console.log("Unable to match route for: " + currentPath);
+    }
   };
 
   map.on('moveend baselayerchange overlaylayerchange', router.updateHash);