Fix #12969: Crash opening ride window with invalid mechanic assigned

This commit is contained in:
Matt committed 2020-09-27 13:40:40 +03:00
1 parent 62b13e68bc
commit 958f3824c9
1 file changed
+3 -3
+3 -3
View File
@@ -4295,11 +4295,11 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
}
else
{
auto peep = GetEntity<Peep>(ride->mechanic)->AsStaff();
if (peep != nullptr && peep->IsMechanic())
auto staff = GetEntity<Staff>(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);
}