Skip to content

Commit

Permalink
fix(intersection): fix possible invalid access
Browse files Browse the repository at this point in the history
Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin committed Mar 5, 2024
1 parent 833722b commit b7ab598
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ lanelet::LineString3d getLineStringFromArcLength(
lanelet::Points3d points;
double accumulated_length = 0;
size_t start_index = linestring.size();
if (start_index == 0) {
return lanelet::LineString3d{lanelet::InvalId, points};
}

Check warning on line 39 in planning/behavior_velocity_intersection_module/src/scene_intersection_stuck.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

getLineStringFromArcLength has a cyclomatic complexity of 9, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
for (size_t i = 0; i < linestring.size() - 1; i++) {
const auto & p1 = linestring[i];
const auto & p2 = linestring[i + 1];
Expand Down

0 comments on commit b7ab598

Please sign in to comment.