Fix #15878: Crash when opening ride window for corrupted vehicle

This commit is contained in:
Michael Steenbeek 2021-11-09 19:41:33 +01:00 committed by GitHub
parent 4ff0022c58
commit e1a1560fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@
- Fix: [#15620] Placing track designs at locations blocked by anything results in wrong error message.
- Fix: [#15843] Tile Inspector can be resized too small.
- Fix: [#15844] Tile Inspector has inconsistent text colours.
- Fix: [#15878] Crash when opening a ride window for a corrupted vehicle.
0.3.5 (2021-11-06)
------------------------------------------------------------------------

View File

@ -1394,7 +1394,13 @@ rct_window* window_ride_open_track(TileElement* tileElement)
*/
rct_window* window_ride_open_vehicle(Vehicle* vehicle)
{
if (vehicle == nullptr)
return nullptr;
Vehicle* headVehicle = vehicle->TrainHead();
if (headVehicle == nullptr)
return nullptr;
uint16_t headVehicleSpriteIndex = headVehicle->sprite_index;
auto ride = headVehicle->GetRide();
if (ride == nullptr)