]> git.openstreetmap.org Git - rails.git/commitdiff
Avoid error when there is no layer with a keyid
authorTom Hughes <tom@compton.nu>
Wed, 24 Apr 2019 10:12:50 +0000 (11:12 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 24 Apr 2019 10:12:50 +0000 (11:12 +0100)
Fixes #2215

app/assets/javascripts/leaflet.map.js

index 0cee211ce86970e3951947ac6f383bdd91b15dc4..1f161ceeaf3f7d5d5c19610be80a7651c8837d9e 100644 (file)
@@ -96,11 +96,11 @@ L.OSM.Map = L.Map.extend({
   },
 
   getMapBaseLayerId: function () {
-    var baseLayer;
+    var baseLayerId;
     this.eachLayer(function (layer) {
-      if (layer.options && layer.options.keyid) baseLayer = layer;
+      if (layer.options && layer.options.keyid) baseLayerId = layer.options.keyid;
     });
-    return baseLayer.options.keyid;
+    return baseLayerId;
   },
 
   getUrl: function (marker) {