From 8b5419e527980e4b6a2a2a6e2b57e106994511d9 Mon Sep 17 00:00:00 2001 From: badai-nguyen Date: Thu, 9 May 2024 20:24:55 +0900 Subject: [PATCH] fix: indices max Signed-off-by: badai-nguyen --- .../ground_segmentation/src/ray_ground_filter_nodelet.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/perception/ground_segmentation/src/ray_ground_filter_nodelet.cpp b/perception/ground_segmentation/src/ray_ground_filter_nodelet.cpp index ae2ad224cf46c..3add6f2203c5b 100644 --- a/perception/ground_segmentation/src/ray_ground_filter_nodelet.cpp +++ b/perception/ground_segmentation/src/ray_ground_filter_nodelet.cpp @@ -280,6 +280,10 @@ void RayGroundFilterComponent::ExtractPointsIndices( size_t no_ground_count = 0; std::vector is_ground_idx(in_cloud_ptr->width, false); for (const auto & idx : in_indices.indices) { + if(std::size_t(idx) >= is_ground_idx.size()) + { + continue; + } is_ground_idx[idx] = true; } for (size_t i = 0; i < is_ground_idx.size(); ++i) {