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

Centroid(...) should return nil on error #649

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

cldellow
Copy link
Contributor

Previously, calling Centroid(...) on an invalid geometry (such as https://www.openstreetmap.org/relation/9769005, which I think gets simplified to having 0 rings) would throw, killing the lua process.

Instead, return nil.

I think this is reasonable? I guess it might be preferable if invalid geometries never made it to the lua code, but then we'd have to proactively fix every geometry, even those not ultimately emitted, which would be expensive.

Previously, calling Centroid(...) on an invalid geometry (such as
https://www.openstreetmap.org/relation/9769005, which I think gets
simplified to having 0 rings) would throw, killing the lua process.

Instead, return nil.
@systemed systemed merged commit deae9ef into systemed:master Jan 19, 2024
5 checks passed
@systemed
Copy link
Owner

Good spot! Thanks.

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.

2 participants