From 4b0b32b2b77f1ba36a0a76e2deb2d732eb62e8d4 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:15:55 +0200 Subject: [PATCH] Fix #22920: Crash when sacking a staff member --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/StaffFirePrompt.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1f4cee7a3e..8ccca2f605 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Fix: [#22615] Crash when drawing Space Rings with an invalid ride entry. - Fix: [#22633] Crash when drawing loading screen with an outdated g2.dat. - Fix: [#22918] Zooming with keyboard moves the view off centre. +- Fix: [#22920] Crash when sacking a staff member. - Fix: [#22921] Wooden RollerCoaster flat to steep railings appear in front of track in front of them. - Fix: [#22962] Fuzzy horizontal-to-vertical line transitions in charts. - Fix: [#23009] Scenarios from RCT Classic (.sea files) are not included in the scenario index. diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 02a1b67df6..28c4528ee7 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -78,6 +78,11 @@ namespace OpenRCT2::Ui::Windows DrawWidgets(dpi); Peep* peep = GetEntity(EntityId::FromUnderlying(number)); + // The staff member may have been fired in the meantime. + if (peep == nullptr) + { + return; + } auto ft = Formatter(); peep->FormatNameTo(ft);