From 2bb8813c41b4a2a7279d994228b60fe277d73c3e Mon Sep 17 00:00:00 2001 From: Xkeeper Date: Tue, 5 Feb 2019 10:58:43 -0800 Subject: [PATCH 1/3] Fix crash in paint_haunted_house_structure [OpenRCT2/OpenRCT2#8662] --- src/openrct2/ride/gentle/HauntedHouse.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openrct2/ride/gentle/HauntedHouse.cpp b/src/openrct2/ride/gentle/HauntedHouse.cpp index 525179e3a3..d8e0a89844 100644 --- a/src/openrct2/ride/gentle/HauntedHouse.cpp +++ b/src/openrct2/ride/gentle/HauntedHouse.cpp @@ -41,6 +41,11 @@ static void paint_haunted_house_structure( Ride* ride = get_ride(rideIndex); rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); + if (rideEntry == nullptr) + { + log_error("Error drawing haunted house, rideEntry is NULL."); + return; + } uint32_t baseImageId = rideEntry->vehicles[0].base_image_id; if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride->vehicles[0] != SPRITE_INDEX_NULL) From a22260b56a0adcb77d485d79cfb8933eaf237aea Mon Sep 17 00:00:00 2001 From: Xkeeper Date: Tue, 5 Feb 2019 11:02:22 -0800 Subject: [PATCH 2/3] Fix crash in MapAnimation re: small scenery [OpenRCT2/OpenRCT2#8662] --- src/openrct2/world/MapAnimation.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 0bb0e2b180..cde85d02fd 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -185,6 +185,9 @@ static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t continue; sceneryEntry = tileElement->AsSmallScenery()->GetEntry(); + if (sceneryEntry == nullptr) + continue; + if (scenery_small_entry_has_flag( sceneryEntry, SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 | SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 | SMALL_SCENERY_FLAG_SWAMP_GOO From 2828cbb2fcdebb88afbd6fc7cecaefee9c28cf09 Mon Sep 17 00:00:00 2001 From: Xkeeper Date: Tue, 5 Feb 2019 11:14:17 -0800 Subject: [PATCH 3/3] Fix crash in FerrisWheel paint [OpenRCT2/OpenRCT2#8662] --- src/openrct2/ride/gentle/FerrisWheel.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openrct2/ride/gentle/FerrisWheel.cpp b/src/openrct2/ride/gentle/FerrisWheel.cpp index d08e7d36d9..95e69c0617 100644 --- a/src/openrct2/ride/gentle/FerrisWheel.cpp +++ b/src/openrct2/ride/gentle/FerrisWheel.cpp @@ -57,6 +57,11 @@ static void paint_ferris_wheel_structure( Ride* ride = get_ride(rideIndex); rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); rct_vehicle* vehicle = nullptr; + if (rideEntry == nullptr) + { + log_error("Error drawing Ferris Wheel, rideEntry is NULL."); + return; + } int8_t xOffset = !(direction & 1) ? axisOffset : 0; int8_t yOffset = (direction & 1) ? axisOffset : 0;