1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Fix #13235: NPE in fix_duplicated_banners()

Co-authored-by: IntelOrca <ted@brambles.org>
This commit is contained in:
Gymnasiast
2021-02-10 15:14:46 +01:00
parent 1cb3330779
commit 2aae1cb84e

View File

@@ -305,9 +305,13 @@ void fix_duplicated_banners()
Guard::Assert(!activeBanners[newBannerIndex]);
// Copy over the original banner, but update the location
auto& newBanner = *GetBanner(newBannerIndex);
newBanner = *GetBanner(bannerIndex);
newBanner.position = { x, y };
auto newBanner = GetBanner(newBannerIndex);
auto oldBanner = GetBanner(bannerIndex);
if (oldBanner != nullptr && newBanner != nullptr)
{
*newBanner = *oldBanner;
newBanner->position = { x, y };
}
tileElement->AsBanner()->SetIndex(newBannerIndex);
}