mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #5814 from rwjuk/spriteguardnull
Guard against NULL in fix_invalid_vehicle_sprite_sizes()
This commit is contained in:
commit
23882ae7a6
|
@ -8684,6 +8684,14 @@ void fix_invalid_vehicle_sprite_sizes()
|
|||
while (rideSpriteIndex != SPRITE_INDEX_NULL) {
|
||||
rct_vehicle *vehicle = GET_VEHICLE(rideSpriteIndex);
|
||||
rct_ride_entry_vehicle *vehicleEntry = vehicle_get_vehicle_entry(vehicle);
|
||||
|
||||
if (vehicle == NULL ||
|
||||
vehicleEntry == NULL ||
|
||||
vehicleEntry == (rct_ride_entry_vehicle*)-1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (vehicle->sprite_width == 0)
|
||||
{
|
||||
vehicle->sprite_width = vehicleEntry->sprite_width;
|
||||
|
@ -8700,4 +8708,4 @@ void fix_invalid_vehicle_sprite_sizes()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue