@@ -1887,8 +1887,9 @@ class KDTreeSingleIndexAdaptor
18871887 DistanceType mindist, distance_vector_t & dists,
18881888 const float epsError) const
18891889 {
1890- /* If this is a leaf node, then do check and return. */
1891- if ((node->child1 == nullptr ) && (node->child2 == nullptr ))
1890+ // If this is a leaf node, then do check and return.
1891+ // If they are equal, both pointers are nullptr.
1892+ if (node->child1 == node->child2 )
18921893 {
18931894 DistanceType worst_dist = result_set.worstDist ();
18941895 for (Offset i = node->node_type .lr .left ;
@@ -2314,8 +2315,9 @@ class KDTreeSingleIndexDynamicAdaptor_
23142315 DistanceType mindist, distance_vector_t & dists,
23152316 const float epsError) const
23162317 {
2317- /* If this is a leaf node, then do check and return. */
2318- if ((node->child1 == nullptr ) && (node->child2 == nullptr ))
2318+ // If this is a leaf node, then do check and return.
2319+ // If they are equal, both pointers are nullptr.
2320+ if (node->child1 == node->child2 )
23192321 {
23202322 DistanceType worst_dist = result_set.worstDist ();
23212323 for (Offset i = node->node_type .lr .left ;
0 commit comments