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

Fix #10389: Invalid read in vehicle_update_travelling (#10390)

This commit is contained in:
Ted John
2019-12-17 20:48:38 +00:00
committed by Michael Steenbeek
parent c2c40fa951
commit b2c0787c2d

View File

@@ -3102,19 +3102,16 @@ static bool vehicle_current_tower_element_is_top(rct_vehicle* vehicle)
{
TileElement* tileElement = map_get_track_element_at_of_type(
vehicle->track_x, vehicle->track_y, vehicle->track_z / 8, vehicle->track_type >> 2);
if (tileElement->IsLastForTile())
if (tileElement != nullptr)
{
return true;
}
while (!tileElement->IsLastForTile())
{
tileElement++;
if (tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK
&& tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_TOWER_SECTION)
while (!tileElement->IsLastForTile())
{
return false;
tileElement++;
if (tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK
&& tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_TOWER_SECTION)
{
return false;
}
}
}
return true;