From 1989e0e9b256d4a001324c64cf6863d7325a5e46 Mon Sep 17 00:00:00 2001 From: Jan Funke Date: Wed, 10 Jul 2024 11:04:28 -0400 Subject: [PATCH] Fix out-of-bounds error on empty rtree queries --- spatial_graph/rtree_wrapper.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spatial_graph/rtree_wrapper.pyx b/spatial_graph/rtree_wrapper.pyx index 5770bc2..0e63ad9 100644 --- a/spatial_graph/rtree_wrapper.pyx +++ b/spatial_graph/rtree_wrapper.pyx @@ -81,8 +81,11 @@ cdef class RTree: cdef search_results results cdef size_t num_results = self.count(bb_min, bb_max) + # TODO: initialize with node dtype equivalent data_array = np.zeros((num_results,), dtype=np.uint64) + if num_results == 0: + return data_array init_search_results_from_numpy(&results, data_array) impl.rtree_search(