Skip to content

Commit

Permalink
fix(concatedate_data): add error handling when sensor points is empty…
Browse files Browse the repository at this point in the history
… (backport autowarefoundation#3814) (autowarefoundation#526)

fix(concatedate_date): add error handling when sensor points is empty (autowarefoundation#3814)

fix(concatedate_date): add error handling when sensor points are empty
  • Loading branch information
h-ohta authored Jun 28, 2023
1 parent eb2f39d commit 3fafc95
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ void PointCloudConcatenateDataSynchronizerComponent::convertToXYZICloud(
sensor_msgs::msg::PointCloud2::SharedPtr & output_ptr)
{
output_ptr->header = input_ptr->header;

if (input_ptr->data.empty()) {
RCLCPP_WARN_STREAM_THROTTLE(
this->get_logger(), *this->get_clock(), 1000, "Empty sensor points!");
return;
}

PointCloud2Modifier<PointXYZI> output_modifier{*output_ptr, input_ptr->header.frame_id};
output_modifier.reserve(input_ptr->width);

Expand Down

0 comments on commit 3fafc95

Please sign in to comment.