Fix NULL checks in facility_paint_setup

This commit is contained in:
Michał Janiszewski 2017-10-30 22:53:58 +01:00
parent b12dad5bd9
commit fb74d12f31
1 changed files with 11 additions and 5 deletions

View File

@ -34,13 +34,19 @@ static void facility_paint_setup(paint_session * session, uint8 rideIndex, uint8
{
bool hasSupports = wooden_a_supports_paint_setup(session, direction & 1, 0, height, session->TrackColours[SCHEME_3], NULL);
Ride * ride = get_ride(rideIndex);
rct_ride_entry * rideEntry = get_ride_entry(ride->subtype);
rct_ride_entry_vehicle * firstVehicleEntry = &rideEntry->vehicles[0];
Ride * ride = get_ride(rideIndex);
rct_ride_entry * rideEntry = get_ride_entry(ride->subtype);
if (rideEntry == NULL || firstVehicleEntry == NULL)
if (rideEntry == nullptr)
{
log_error("Error drawing facility, rideEntry or firstVehicleEntry is NULL.");
log_error("Error drawing facility, rideEntry is NULL.");
return;
}
rct_ride_entry_vehicle * firstVehicleEntry = &rideEntry->vehicles[0];
if (firstVehicleEntry == nullptr)
{
log_error("Error drawing facility, firstVehicleEntry is NULL.");
return;
}