]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/note.js
Update to leaflet 1.8.0
[rails.git] / app / assets / javascripts / index / note.js
index 3793c573e6122d5165df17181e545e99701dd7d0..7efec6c5d931a395f08e591dd64e4503e483dd4c 100644 (file)
@@ -73,7 +73,7 @@ OSM.Note = function (map) {
     var data = $(".details").data(),
         latLng = L.latLng(data.coordinates.split(","));
 
-    if (!map.hasLayer(halo)) {
+    if (!halo || !map.hasLayer(halo)) {
       halo = L.circleMarker(latLng, {
         weight: 2.5,
         radius: 20,
@@ -83,7 +83,8 @@ OSM.Note = function (map) {
       map.addLayer(halo);
     }
 
-    if (map.hasLayer(currentNote)) map.removeLayer(currentNote);
+    if (currentNote && map.hasLayer(currentNote)) map.removeLayer(currentNote);
+
     currentNote = L.marker(latLng, {
       icon: noteIcons[data.status],
       opacity: 1,