Fixed null pointer error

This commit is contained in:
Mathieu Labbe
2015-03-27 17:43:09 -04:00
parent f0b7b183c5
commit 43ba3efaa0
+2 -2
View File
@@ -142,12 +142,12 @@ private:
} }
pcl::PointCloud<pcl::PointXYZ>::Ptr groundCloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr groundCloud(new pcl::PointCloud<pcl::PointXYZ>);
if(groundPub_.getNumSubscribers() && ground->size()) if(groundPub_.getNumSubscribers() && ground.get() && ground->size())
{ {
pcl::copyPointCloud(*cloud, *ground, *groundCloud); pcl::copyPointCloud(*cloud, *ground, *groundCloud);
} }
pcl::PointCloud<pcl::PointXYZ>::Ptr obstaclesCloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr obstaclesCloud(new pcl::PointCloud<pcl::PointXYZ>);
if(obstaclesPub_.getNumSubscribers() && obstacles->size()) if(obstaclesPub_.getNumSubscribers() && obstacles.get() && obstacles->size())
{ {
pcl::copyPointCloud(*cloud, *obstacles, *obstaclesCloud); pcl::copyPointCloud(*cloud, *obstacles, *obstaclesCloud);
} }