]> git.openstreetmap.org Git - rails.git/commitdiff
Don't set state if it doesn't exist
authorJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 14 Nov 2013 00:01:54 +0000 (16:01 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 14 Nov 2013 00:01:54 +0000 (16:01 -0800)
app/assets/javascripts/router.js

index fbad1e28c1695f90d37b5a40bef573f491e1afd1..5b9cdad07141515c883065671bef73c602a8ea06 100644 (file)
@@ -88,8 +88,10 @@ OSM.Router = function(map, rts) {
       currentRoute = routes.recognize(currentPath);
       currentRoute.run('popstate', currentPath);
       var state = e.originalEvent.state;
       currentRoute = routes.recognize(currentPath);
       currentRoute.run('popstate', currentPath);
       var state = e.originalEvent.state;
-      map.setView(state.center, state.zoom, {animate: false});
-      map.updateLayers(state.layers);
+      if (state.center) {
+        map.setView(state.center, state.zoom, {animate: false});
+        map.updateLayers(state.layers);
+      }
     });
 
     return function (url) {
     });
 
     return function (url) {