From f24309ad3e7b2a805f032afdef9765dc6d0bc022 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 13 Nov 2013 16:01:54 -0800 Subject: [PATCH] Don't set state if it doesn't exist --- app/assets/javascripts/router.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index fbad1e28c..5b9cdad07 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -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) { -- 2.39.5