1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Remove to do statement by explicit null check on collideVehicle

This commit is contained in:
Rik Smeets
2024-04-07 20:21:17 +02:00
parent e250ec3b66
commit b009643ab0

View File

@@ -6638,14 +6638,13 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
}
}
if (!mayCollide)
if (!mayCollide || collideVehicle == nullptr)
{
CollisionDetectionTimer = 0;
return false;
}
if (collideVehicle->status == Vehicle::Status::TravellingBoat
&& sub_state == BoatHireSubState::EnteringReturnPosition)
if (collideVehicle->status == Vehicle::Status::TravellingBoat && sub_state == BoatHireSubState::EnteringReturnPosition)
{
return false;
}
@@ -6659,8 +6658,6 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
return true;
}
// TODO Is it possible for collideVehicle to be NULL?
if (status == Vehicle::Status::MovingToEndOfStation)
{
if (Orientation == 0)