From 18ce417dc0bffc073afa8339f1d2cf535f3b12ba Mon Sep 17 00:00:00 2001 From: John Mulcahy Date: Tue, 4 Apr 2023 05:35:20 -0400 Subject: [PATCH] Fix 19231 - Fix Tile Copy/Paste null pointer exception --- distribution/changelog.txt | 1 + src/openrct2/world/TileInspector.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index f503ac2e75..9eb0c6847d 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,7 @@ - Improved: [#18490] Reduce guests walking through trains on level crossing next to station. - Improved: [#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab. - Fix: [#18895] Responding mechanic blocked at level crossing. +- Fix: [#19231] Crash due to null pointer to previously deleted banner in tile copy/paste functionality - Fix: [#19296] Crash due to a race condition for parallel object loading. - Fix: [#19756] Crash with title sequences containing no commands. - Fix: [#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics. diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index bfff423660..440ffbd492 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -329,10 +329,15 @@ namespace OpenRCT2::TileInspector auto tileLoc = TileCoordsXY(loc); + auto bannerIndex = element.GetBannerIndex(); + if (bannerIndex != BannerIndex::GetNull() && GetBanner(bannerIndex) == nullptr) + { + return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + } + if (isExecuting) { // Check if the element to be pasted refers to a banner index - auto bannerIndex = element.GetBannerIndex(); if (bannerIndex != BannerIndex::GetNull()) { // The element to be pasted refers to a banner index - make a copy of it