Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '_leaflet_pos' of undefined #27

Open
anawan1010 opened this issue May 27, 2021 · 1 comment
Open

TypeError: Cannot read property '_leaflet_pos' of undefined #27

anawan1010 opened this issue May 27, 2021 · 1 comment

Comments

@anawan1010
Copy link

anawan1010 commented May 27, 2021

calling getPosition(marker._icon) when marker._icon is null/undefined causes TypeError Cannot read property '_leaflet_pos' of undefined

@hlovdal
Copy link
Contributor

hlovdal commented Jan 3, 2023

The problem is the function

function getPosition(el) {
	return el._leaflet_pos || new Point(0, 0);
}

which unconditionally dereferences el, while the safe version would look like

function getPosition(el) {
	return el?._leaflet_pos || new Point(0, 0);
}

This is fixed in commit 421654e12a2d - fix Cannot read property '_leaflet_pos' of undefined in spexigeo's fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants