storpipfugl / pykdtree

Fast kd-tree implementation in Python
GNU Lesser General Public License v3.0
206 stars 48 forks source link

Segmentation fault on empty points #116

Open STNLd2 opened 2 weeks ago

STNLd2 commented 2 weeks ago

Please add a check for empty point array in KDTree input.

tree = KDTree(np.array([]))

falls with the segmentation fault.

mraspaud commented 2 weeks ago

@STNLd2 thanks for bring this to our attention! is this anything you are willing to provide a fix for?

STNLd2 commented 2 weeks ago

@mraspaud Could you take care of it? Don't want to mess with forking just for 2 lines of code :)

djhoese commented 2 weeks ago

@STNLd2 I know that @mraspaud is getting ready to go on holiday so he might not have time for this. I know I don't right now either. Since you found the issue, filed the bug, and have the use case where you'd like this check, it may be best for you to tackle this. And it wouldn't be just 2 lines of code because this could use a test in the test_tree.py module too.

STNLd2 commented 2 days ago

Sorry, I've just noticed the last message. I see. I'll do it.