From 958f3824c905874ea9dedbe9078ea646b7dca44c Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 27 Sep 2020 13:36:23 +0300 Subject: [PATCH] Fix #12969: Crash opening ride window with invalid mechanic assigned --- src/openrct2-ui/windows/Ride.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 02af01c221..d5a7f88c90 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4295,11 +4295,11 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi) } else { - auto peep = GetEntity(ride->mechanic)->AsStaff(); - if (peep != nullptr && peep->IsMechanic()) + auto staff = GetEntity(ride->mechanic); + if (staff != nullptr && staff->IsMechanic()) { auto ft = Formatter::Common(); - peep->FormatNameTo(ft); + staff->FormatNameTo(ft); gfx_draw_string_left_wrapped( dpi, gCommonFormatArgs, screenCoords + ScreenCoordsXY{ 4, 0 }, 280, stringId, COLOUR_BLACK); }