From a2377b27fc65f0eae83079749db2f0936e0b5d4e Mon Sep 17 00:00:00 2001 From: satoshi-ota Date: Tue, 24 Oct 2023 12:59:04 +0900 Subject: [PATCH] fix(utils): guard invalid access Signed-off-by: satoshi-ota --- planning/behavior_path_planner/src/utils/utils.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/planning/behavior_path_planner/src/utils/utils.cpp b/planning/behavior_path_planner/src/utils/utils.cpp index c1a49a9635592..d08074b633500 100644 --- a/planning/behavior_path_planner/src/utils/utils.cpp +++ b/planning/behavior_path_planner/src/utils/utils.cpp @@ -2003,6 +2003,11 @@ void makeBoundLongitudinallyMonotonic( std::vector ret = bound; auto itr = std::next(ret.begin()); while (std::next(itr) != ret.end()) { + if (itr == ret.begin()) { + itr++; + continue; + } + const auto p1 = *std::prev(itr); const auto p2 = *itr; const auto p3 = *std::next(itr);