Merge pull request #13030 from ZehMatt/fix-4617-2

Fix #4617: Crash when rotating with invalid viewport open
This commit is contained in:
ζeh Matt 2020-09-30 00:53:32 +03:00 committed by GitHub
commit 30307ec42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -322,10 +322,7 @@ static void window_sign_paint(rct_window* w, rct_drawpixelinfo* dpi)
*/
static void window_sign_viewport_rotate(rct_window* w)
{
rct_viewport* view = w->viewport;
w->viewport = nullptr;
view->width = 0;
w->RemoveViewport();
auto banner = GetBanner(w->number);

View File

@ -42,3 +42,12 @@ void rct_window::Invalidate()
{
gfx_set_dirty_blocks({ windowPos, windowPos + ScreenCoordsXY{ width, height } });
}
void rct_window::RemoveViewport()
{
if (viewport == nullptr)
return;
viewport->width = 0;
viewport = nullptr;
}

View File

@ -94,6 +94,7 @@ struct rct_window
void SetLocation(const CoordsXYZ& coords);
void ScrollToViewport();
void Invalidate();
void RemoveViewport();
};
// rct2: 0x01420078