question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Icon.Default.detectIconPath can throw TypeError: path is null

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
perliedmancommented, Dec 4, 2019
0reactions
chpiocommented, Nov 29, 2019

Is there no other way to pass configuration directly to leaflets js code, reading css is an unusual way passing config to a js lib?

Map seem to break too when the js code gets executed before the css can take effect.

This is relaying on hacks like this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Icon.Default.detectIconPath can throw TypeError: path is null
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....
Read more >
type 'Null' is not a subtype of type 'Icon' - flutter - Stack Overflow
Ok yes sure. It's because Dropdown needs a value which is not null. I will create a Dartpad with the solution, makes it...
Read more >
TypeError: cannot use 'in' operator to search for 'x' in 'y'
The in operator can only be used to check if a property is in an object. You can't search in strings, or in...
Read more >
"TypeError: Cannot call method 'getIdentifier' of null ... - IBM
Symptom. The error message can be different depending on the version of RTC and browser being used. It can be one of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found