From fd4e6bd031808202d6a3c2495d3c43ce003d2bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 9 Apr 2022 12:12:34 +0200 Subject: [PATCH] Fix crash after alt-tab (#16070) --- src/openrct2/drawing/LightFX.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 3b434fac5f..b4ab844e91 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -527,6 +527,10 @@ void lightfx_render_lights_to_frontbuffer() continue; } + // Clamp the reads to be no larger than the buffer size + bufReadHeight = std::min(_pixelInfo.height, bufReadHeight); + bufReadWidth = std::min(_pixelInfo.width, bufReadWidth); + bufWriteX = inRectCentreX - bufReadWidth / 2; bufWriteY = inRectCentreY - bufReadHeight / 2;