Don't call updateLayers if the new state has no layer config
authorTom Hughes <tom@compton.nu>
Thu, 13 Mar 2014 21:36:10 +0000 (21:36 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 13 Mar 2014 21:36:33 +0000 (21:36 +0000)
Fixes #719

app/assets/javascripts/leaflet.map.js.erb

index 35370ae996108be6058ecc5b8cb8f8149d53bf49..496e2985859df30fc2d4811bb3c22aa5d457a55b 100644 (file)
@@ -241,7 +241,7 @@ L.OSM.Map = L.Map.extend({
 
   setState: function(state, options) {
     if (state.center) this.setView(state.center, state.zoom, options);
-    this.updateLayers(state.layers);
+    if (state.layers) this.updateLayers(state.layers);
   }
 });