Skip to content

Commit

Permalink
Modified @KdTreeFLANN@ to throw an error when an empty cloud is passe…
Browse files Browse the repository at this point in the history
…d in. Please revert if FLANN has since fixed this segfault

git-svn-id: svn+ssh://svn.pointclouds.org/pcl/trunk@8667 a9d63959-f2ad-4865-b262-bf0e56cfafb6
  • Loading branch information
sdmiller committed Feb 6, 2013
1 parent b68054b commit 8c22a17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ pcl::KdTreeFLANN<PointT, Dist>::setInputCloud (const PointCloudConstPtr &cloud,
convertCloudToArray (*input_);
}
total_nr_points_ = static_cast<int> (index_mapping_.size ());
if (total_nr_points_ == 0)
{
PCL_ERROR ("[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud!\n");
return;
}

flann_index_.reset (new FLANNIndex (::flann::Matrix<float> (cloud_,
index_mapping_.size (),
Expand Down

0 comments on commit 8c22a17

Please sign in to comment.