Fix #9491: Access violation in window_ride_init_viewport

This commit is contained in:
Jim Armstrong authored and Michael Steenbeek committed 2019-08-01 11:11:59 +02:00
1 parent 9236f5f10b
commit 6458514361
2 files changed
+6 -1

No files matched your search

+1
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
+5 -1
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;
}