Skip to content

Commit

Permalink
fix(ndt_scan_matcher): ndt_scan_matcher crash when input cloud is emp…
Browse files Browse the repository at this point in the history
…ty. (autowarefoundation#3354)

* Fixed NDTScanMatcher crash when input cloud is empty.

* style(pre-commit): autofix

---------

Co-authored-by: Zygfryd Wieszok <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: M(-_-)Sakamoto <[email protected]>
  • Loading branch information
4 people authored May 12, 2023
1 parent 8400a86 commit 5e5c4dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ void NDTScanMatcher::callback_regularization_pose(
void NDTScanMatcher::callback_sensor_points(
sensor_msgs::msg::PointCloud2::ConstSharedPtr sensor_points_sensorTF_msg_ptr)
{
if (sensor_points_sensorTF_msg_ptr->data.empty()) {
RCLCPP_WARN_STREAM_THROTTLE(this->get_logger(), *this->get_clock(), 1, "Empty sensor points!");
return;
}

// mutex ndt_ptr_
std::lock_guard<std::mutex> lock(ndt_ptr_mtx_);

Expand Down

0 comments on commit 5e5c4dd

Please sign in to comment.