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

Zero division fix (on leaflet.0.8-dev branch) #65

Conversation

olzraiti
Copy link
Contributor

If the map was mounted to a node that's not in the DOM (which is not so rare for example in React environment), an error was thrown because pattern.getComputedTextLength() resulted in 0, which caused a division by zero. I fixed the bug by checking if the map is rendered in the body.

You can reproduce the bug like this:

document.createElement("div").appendChild(mapContainerNode);
map.invalidateSize();

@olzraiti
Copy link
Contributor Author

I updated the code to just fix with 1 instead of 0. Much more fool proof and works on every case.

@olzraiti
Copy link
Contributor Author

Closed by #79

@olzraiti olzraiti closed this Feb 17, 2020
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

Successfully merging this pull request may close these issues.

1 participant