From 06dc75845a3a9896d03a9e6b67eac49a79e655f1 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Fri, 1 Oct 2021 18:10:25 +0200 Subject: [PATCH] Fix #15476: Crash in map_place_clear_func() --- distribution/changelog.txt | 1 + src/openrct2/world/SmallScenery.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 5b1ac91904..c32fc53503 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -27,6 +27,7 @@ - Fix: [#15255] Tile Inspector shows banner information on walls that do not contain one. - Fix: [#15257] Chat icon shows in scenario/track editor. Other icons don't disable when deactivated in options menu. - Fix: [#15289] Unexpected behavior with duplicated banners which also caused desyncs in multiplayer. +- Fix: [#15476] Crash when placing/clearing small scenery. - Fix: [#15487] Map animations do not work correctly when loading an exported SV6 file in vanilla RCT2. - Fix: [#15496] Crash in paint_swinging_inverter_ship_structure(). - Improved: [#3417] Crash dumps are now placed in their own folder. diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index c71fc753f4..14ee1b3509 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -37,11 +37,11 @@ static int32_t map_place_clear_func( if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) { - if (scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_IS_TREE)) + if (scenery != nullptr && scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_IS_TREE)) return 1; } - if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (!(gParkFlags & PARK_FLAGS_NO_MONEY) && scenery != nullptr) *price += scenery->removal_price * 10; if (flags & GAME_COMMAND_FLAG_GHOST)