diff --git a/src/map/Map.js b/src/map/Map.js index b6787738..5367ba33 100644 --- a/src/map/Map.js +++ b/src/map/Map.js @@ -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 = {};