Don't set state if it doesn't exist
This commit is contained in:
parent
be56eb5bad
commit
f24309ad3e
1 changed files with 4 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue