diff --git a/src/cpp/flann/algorithms/hierarchical_clustering_index.h b/src/cpp/flann/algorithms/hierarchical_clustering_index.h index 91db6368..300bc3e7 100644 --- a/src/cpp/flann/algorithms/hierarchical_clustering_index.h +++ b/src/cpp/flann/algorithms/hierarchical_clustering_index.h @@ -444,7 +444,7 @@ class HierarchicalClusteringIndex : public NNIndex { dst = new(pool_) Node(); dst->pivot_index = src->pivot_index; - dst->pivot = points_[dst->pivot_index]; + dst->pivot = dst->pivot_index == SIZE_MAX ? NULL : points_[dst->pivot_index]; if (src->childs.size()==0) { dst->points = src->points;