]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/router.js
Don't set state if it doesn't exist
[rails.git] / 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;
-      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) {