Skip to content
This repository was archived by the owner on Mar 10, 2023. It is now read-only.

Commit 182c479

Browse files
committed
Fix zero-division error on empty clouds
Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl>
1 parent efdbff0 commit 182c479

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

points_preprocessor/nodes/ray_ground_filter/ray_ground_filter.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@ void RayGroundFilter::filterROSMsg(const sensor_msgs::PointCloud2ConstPtr in_ori
103103
const std::vector<void*>& in_selector,
104104
const sensor_msgs::PointCloud2::Ptr out_filtered_msg)
105105
{
106-
size_t point_size = in_origin_cloud->row_step/in_origin_cloud->width; // in Byte
106+
size_t point_size = 0;
107+
if (in_origin_cloud->width == 0)
108+
{
109+
ROS_WARN_THROTTLE(5, "Cloud width of zero, nothing to process");
110+
}
111+
else
112+
{
113+
size_t point_size = in_origin_cloud->row_step/in_origin_cloud->width; // in Byte
114+
}
107115

108116
// TODO(yoan picchi) I fear this may do a lot of cache miss because it is sorted in the radius
109117
// and no longer sorted in the original pointer. One thing to try is that, given

0 commit comments

Comments
 (0)