1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Don't crash if mapElement is null

This allows for loading parks such as "Cocopa Bay"
This commit is contained in:
Michał Janiszewski
2016-02-26 22:58:06 +01:00
parent e4c20902ba
commit 4a24aa6cf3
2 changed files with 4 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ static void ride_update_station_blocksection(rct_ride *ride, int stationIndex)
mapElement = ride_get_station_start_track_element(ride, stationIndex);
if ((ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0) || mapElement->flags & 0x20) {
if ((ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0) || (mapElement != NULL && mapElement->flags & 0x20)) {
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
if ((ride->station_depart[stationIndex] & STATION_DEPART_FLAG) || (mapElement->properties.track.sequence & 0x80))
@@ -75,7 +75,7 @@ static void ride_update_station_blocksection(rct_ride *ride, int stationIndex)
if (!(ride->station_depart[stationIndex] & STATION_DEPART_FLAG)) {
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, 1);
} else if (mapElement->properties.track.sequence & 0x80) {
} else if (mapElement != NULL && mapElement->properties.track.sequence & 0x80) {
ride_invalidate_station_start(ride, stationIndex, 1);
}
}

View File

@@ -3359,8 +3359,8 @@ static void window_ride_locate_mechanic(rct_window *w)
static void window_ride_maintenance_draw_bar(rct_window *w, rct_drawpixelinfo *dpi, int x, int y, int value, int unk)
{
gfx_fill_rect_inset(dpi, x, y, x + 149, y + 8, w->colours[1], 0x30);
if (unk & (1 << 31)) {
unk &= ~(1 << 31);
if (unk & (1u << 31)) {
unk &= ~(1u << 31);
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 && (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8))
return;
}