From c9a692f39311469f19b9390c26f4252a43bd4fab Mon Sep 17 00:00:00 2001 From: Matteo Ragni Date: Fri, 27 Feb 2026 14:57:10 +0100 Subject: [PATCH 1/3] Fixes #780 Checks the validity of lane_link before searching for the connected lane. The logic of the code has been inverted to continue-early in the look if one of the reference is null. This is my first contribution to the project, make sure to review it! --- .../SourceFiles/OSIReporter.cpp | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp b/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp index c19d47081..541addb03 100644 --- a/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp +++ b/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp @@ -1550,20 +1550,34 @@ int OSIReporter::UpdateOSIIntersection() incomming_road->GetDrivingLaneById(incomming_s_value, junctionlanelink->from_)->GetGlobalId()); roadmanager::Lane *lane = connecting_road->GetDrivingLaneById(connecting_outgoing_s_value, junctionlanelink->to_); - roadmanager::Lane *successor_lane = - lane != nullptr ? outgoing_road->GetDrivingLaneById(outgoing_s_value, lane->GetLink(connecting_road_link_type)->GetId()) - : nullptr; - if (lane != nullptr && successor_lane != nullptr) - { - laneparing->mutable_successor_lane_id()->set_value(successor_lane->GetGlobalId()); - } - else - { + if (!lane) { LOG_ERROR("Connecting road {} incoming road {} failed get lane by id {}", connecting_road->GetId(), connection->GetIncomingRoad()->GetId(), junctionlanelink->to_); + continue; + } + + roadmanager::LaneLink *lane_link = lane->GetLink(connecting_road_link_type); + if (!lane_link) { + LOG_ERROR("Connecting road {} incoming road {} failed get lane by id {}, missing link: maybe vanishing lane?", + connecting_road->GetId(), + connection->GetIncomingRoad()->GetId(), + junctionlanelink->to_); + continue; } + + roadmanager::Lane *successor_lane = outgoing_road->GetDrivingLaneById(outgoing_s_value, lane_link->GetId()); + if (!successor_lane) + { + LOG_ERROR("Outgoing road {} incoming road {} failed get lane by id {}", + outgoing_road->GetId(), + connection->GetIncomingRoad()->GetId(), + lane_link->GetId()); + continue; + } + + laneparing->mutable_successor_lane_id()->set_value(successor_lane->GetGlobalId()); } } } From 71626a39694660fe88c617af1bb1bc2c3fd7a175 Mon Sep 17 00:00:00 2001 From: Emil Knabe Date: Thu, 19 Mar 2026 18:14:06 +0100 Subject: [PATCH 2/3] Minor formatting --- .../Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp b/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp index 541addb03..a0aab7530 100644 --- a/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp +++ b/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp @@ -1550,7 +1550,8 @@ int OSIReporter::UpdateOSIIntersection() incomming_road->GetDrivingLaneById(incomming_s_value, junctionlanelink->from_)->GetGlobalId()); roadmanager::Lane *lane = connecting_road->GetDrivingLaneById(connecting_outgoing_s_value, junctionlanelink->to_); - if (!lane) { + if (!lane) + { LOG_ERROR("Connecting road {} incoming road {} failed get lane by id {}", connecting_road->GetId(), connection->GetIncomingRoad()->GetId(), @@ -1559,7 +1560,8 @@ int OSIReporter::UpdateOSIIntersection() } roadmanager::LaneLink *lane_link = lane->GetLink(connecting_road_link_type); - if (!lane_link) { + if (!lane_link) + { LOG_ERROR("Connecting road {} incoming road {} failed get lane by id {}, missing link: maybe vanishing lane?", connecting_road->GetId(), connection->GetIncomingRoad()->GetId(), From 342a5c01d3753677c9e9b4c1d2bbb423a1bed2b8 Mon Sep 17 00:00:00 2001 From: Emil Knabe Date: Fri, 20 Mar 2026 17:27:53 +0100 Subject: [PATCH 3/3] Further minor formatting --- .../Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp b/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp index a0aab7530..a84337319 100644 --- a/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp +++ b/EnvironmentSimulator/Modules/ScenarioEngine/SourceFiles/OSIReporter.cpp @@ -1550,7 +1550,7 @@ int OSIReporter::UpdateOSIIntersection() incomming_road->GetDrivingLaneById(incomming_s_value, junctionlanelink->from_)->GetGlobalId()); roadmanager::Lane *lane = connecting_road->GetDrivingLaneById(connecting_outgoing_s_value, junctionlanelink->to_); - if (!lane) + if (!lane) { LOG_ERROR("Connecting road {} incoming road {} failed get lane by id {}", connecting_road->GetId(), @@ -1560,7 +1560,7 @@ int OSIReporter::UpdateOSIIntersection() } roadmanager::LaneLink *lane_link = lane->GetLink(connecting_road_link_type); - if (!lane_link) + if (!lane_link) { LOG_ERROR("Connecting road {} incoming road {} failed get lane by id {}, missing link: maybe vanishing lane?", connecting_road->GetId(),