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

TurfMeasurement#length method cannot handle empty lists #1484

Open
Blafasel3 opened this issue Aug 26, 2022 · 0 comments
Open

TurfMeasurement#length method cannot handle empty lists #1484

Blafasel3 opened this issue Aug 26, 2022 · 0 comments

Comments

@Blafasel3
Copy link

Blafasel3 commented Aug 26, 2022

The other day, I encountered what I regard as an issue in the following Code snippet:


The scenario is the following: We have a list of GPS points of which some or all are invalid which is denoted by the coordinates being (0 , 0) - which IS bad Design, but our Team cannot change this... 🙄. Thus, we filter out those points before passing it to the length method. We just encountered an IndexOutOfBoundsException when the list is empty because there is no length check on the list. I guess the fix here is relatively easy, but the question ist - what should be returned in this case. We built in a check before hand returning 0 in this particular case. Maybe even a checked exception might be a feasible idea.

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

No branches or pull requests

2 participants