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:
Roemer Vlasveld 2013-01-21 23:22:01 +01:00
parent a000304473
commit 109fd06ae6

View File

@ -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 = {};