Skip to content

Commit

Permalink
Merge pull request Leaflet#1048 from datadope-io/bug/_zoom_undefined
Browse files Browse the repository at this point in the history
Avoid crashing with some zoom events
  • Loading branch information
KristjanESPERANTO authored Dec 22, 2024
2 parents e9a8341 + e4b93e4 commit 70ca4c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/MarkerClusterGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({
currentZoom = this._zoom;
if (layer.__parent) {
while (visibleLayer.__parent._zoom >= currentZoom) {
// Check if visibleLayer.__parent is undefined to avoid crashing in the next loop.
if (visibleLayer.__parent === undefined) {
break;
}
visibleLayer = visibleLayer.__parent;
}
}
Expand Down Expand Up @@ -730,7 +734,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({
delete e.target.__dragStart;
if (dragStart) {
this._moveChild(e.target, dragStart, e.target._latlng);
}
}
},


Expand Down

0 comments on commit 70ca4c3

Please sign in to comment.