Fix #9491: Access violation in window_ride_init_viewport

This commit is contained in:
Jim Armstrong 2019-08-01 05:11:59 -04:00 committed by Michael Steenbeek
parent 9236f5f10b
commit 6458514361
2 changed files with 6 additions and 1 deletions

View File

@ -131,6 +131,7 @@ The following people are not part of the development team, but have been contrib
* Trevor Harkness (tharkne)
* Steve Xu (stevexu-umich)
* (aw20368)
* Jim Armstrong (41northstudios)
## Toolchain
* (Balletie) - macOS

View File

@ -1865,7 +1865,11 @@ static void window_ride_init_viewport(rct_window* w)
if (ride_entry && ride_entry->tab_vehicle != 0)
{
rct_vehicle* vehicle = GET_VEHICLE(focus.sprite.sprite_id);
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL)
if (vehicle == nullptr)
{
focus.sprite.sprite_id = SPRITE_INDEX_NULL;
}
else if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL)
{
focus.sprite.sprite_id = vehicle->next_vehicle_on_train;
}