Icon.Default.detectIconPath can throw TypeError: path is nullΒ #5534
Description
The line is specified at this link:
https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Icon.Default.js#L52
DomUtil.getStyle
has the ability to return null, but there is no check for this in the calling method.
This can occur in a few scenarios, but specifically occurs if you are using the leaflet.js library, but the DOM hasn't loaded yet.
In my situation, in Firefox (not IE or Chrome) leaflet is loading in an iframe that is in a separate tab. I'm not sure why, but when the detectIconPath
attempts to create the div with the class, the rule is not loaded and there is no background-image.
Due to this, even if I override the options with a new imagePath, the check still attempts and throws the exception since there isn't a check.
Current workaround is to assign L.Icon.Default.imagePath
directly so that method is not called.
Activity