From 4d51105c44426dda01a1d0d5d756e757a3919fe1 Mon Sep 17 00:00:00 2001 From: danzel Date: Wed, 12 Sep 2012 17:40:43 +1200 Subject: [PATCH] Don't barf if we are asked to remove a layer that we don't have --- src/MarkerClusterGroup.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index fde1ab3d2..e7fea2796 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -94,6 +94,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({ }, removeLayer: function (layer) { + if (!layer.__parent) { + return this; + } + if (this._unspiderfy) { this._unspiderfy(); this._unspiderfyLayer(layer);