diff options
-rw-r--r-- | leaflet-indoor.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/leaflet-indoor.js b/leaflet-indoor.js index be73a6e..ee3fd52 100644 --- a/leaflet-indoor.js +++ b/leaflet-indoor.js @@ -71,7 +71,10 @@ L.Indoor = L.Class.extend({ } }, onRemove: function (map) { - this._map.removeLayer(this._layers[this._level]); + if (this._level in this._layers) { + this._map.removeLayer(this._layers[this._level]); + } + this._map = null; }, addData: function(data) { |