-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
L.Map.hasLayer does this:
var id = L.Util.stamp(layer);However it might happen that the variable "layer" is null. For instance, there could be a variable like "currentActiveLayer", which might be null. Doing map.hasLayer(currentActiveLayer) results in "Uncaught TypeError: Cannot read property '_leaflet_id' of null".
In a related subject, I think it would be very natural if L.LayerGroup also had a "hasLayer" method.
Thanks.