Fixed rare crash when traffic lights become dormant.

This commit is contained in:
Axel 2021-06-22 16:29:58 +02:00 committed by bernat
parent 0cacdad88a
commit cccb2755eb
1 changed files with 8 additions and 1 deletions

View File

@ -47,7 +47,14 @@ static auto FWorldObserver_GetActorState(const FCarlaActor &View, const FActorRe
{
state.vehicle_data.has_traffic_light = true;
auto* TrafficLightView = Registry.FindCarlaActor(TrafficLight);
state.vehicle_data.traffic_light_id = TrafficLightView->GetActorId();
if(TrafficLightView)
{
state.vehicle_data.traffic_light_id = TrafficLightView->GetActorId();
}
else
{
state.vehicle_data.has_traffic_light = false;
}
}
else
{