hasLayer not checking for null
Return false when checking for a null object in L.Map.hasLayer, in response to issue #1282.
This commit is contained in:
parent
a000304473
commit
109fd06ae6
@ -192,6 +192,8 @@ L.Map = L.Class.extend({
|
||||
},
|
||||
|
||||
hasLayer: function (layer) {
|
||||
if (!layer) { return false; }
|
||||
|
||||
var id = L.stamp(layer);
|
||||
return this._layers.hasOwnProperty(id);
|
||||
},
|
||||
@ -466,7 +468,7 @@ L.Map = L.Class.extend({
|
||||
},
|
||||
|
||||
_initLayers: function (layers) {
|
||||
layers = layers ? (L.Util.isArray(layers) ? layers : [layers]) : [];
|
||||
layers = layers ? (L.Util.isArray(layers) ? layers : [layers]) : [];
|
||||
|
||||
this._layers = {};
|
||||
this._zoomBoundLayers = {};
|
||||
|
Loading…
Reference in New Issue
Block a user