diff options
author | Christopher Baines <mail@cbaines.net> | 2014-05-29 22:20:25 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2014-05-29 22:20:25 +0100 |
commit | be1267e96abb6b3c23ecf2496ae135d8b736323c (patch) | |
tree | 49ca3e8cbd72da62db7392822c729a628319ab9d | |
parent | 469969b0badf374bae95ae2679a0fb109616b876 (diff) | |
download | leaflet-indoor-be1267e96abb6b3c23ecf2496ae135d8b736323c.tar leaflet-indoor-be1267e96abb6b3c23ecf2496ae135d8b736323c.tar.gz |
Check that the level exists before trying to remove it
-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) { |