File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -270,8 +270,9 @@ class KNNResultSet
270270 // ! full, or the maximum possible distance, if not full yet.
271271 DistanceType worstDist () const
272272 {
273- return count < capacity ? std::numeric_limits<DistanceType>::max ()
274- : dists[count - 1 ];
273+ return (count < capacity || !count)
274+ ? std::numeric_limits<DistanceType>::max ()
275+ : dists[count - 1 ];
275276 }
276277
277278 void sort ()
@@ -365,8 +366,8 @@ class RKNNResultSet
365366 // ! full, or the maximum possible distance, if not full yet.
366367 DistanceType worstDist () const
367368 {
368- return count < capacity ? maximumSearchDistanceSquared
369- : dists[count - 1 ];
369+ return ( count < capacity || !count) ? maximumSearchDistanceSquared
370+ : dists[count - 1 ];
370371 }
371372
372373 void sort ()
You can’t perform that action at this time.
0 commit comments