OccupancyGrid:segmentCloud() reset indices ptr to make sure the returned pointer is valid

This commit is contained in:
matlabbe
2018-11-15 10:08:04 -05:00
parent 9efd7c14fc
commit 963aea5c0d

View File

@@ -44,6 +44,13 @@ typename pcl::PointCloud<PointT>::Ptr OccupancyGrid::segmentCloud(
pcl::IndicesPtr & obstaclesIndices,
pcl::IndicesPtr * flatObstacles) const
{
groundIndices.reset(new std::vector<int>);
obstaclesIndices.reset(new std::vector<int>);
if(flatObstacles)
{
flatObstacles->reset(new std::vector<int>);
}
typename pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>);
pcl::IndicesPtr indices(new std::vector<int>);