From 9a100b82b47b2b40ccf311a90cf2f0f562d30053 Mon Sep 17 00:00:00 2001 From: Matt <5415177+ZehMatt@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:22:59 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#21498:=20Crash=20when=20the=20size=20of?= =?UTF-8?q?=20text=20can=E2=80=99t=20be=20determined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- distribution/changelog.txt | 1 + src/openrct2/paint/tile_element/Paint.Banner.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 5f6ff236ef..1a5027cf09 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -31,6 +31,7 @@ - Fix: [#21347] Too many options are hidden if the platform has no file picker. - Fix: [#21350] Maze and Mini Golf track designs from RCT1 not shown in track designs list. - Fix: [#21425] Additional missing/misplaced land & construction rights tiles in Japanese Coastal Reclaim. +- Fix: [#21498] Crash when the size of text can’t be determined. - Fix: [objects#262, objects#263, objects#265, objects#266, objects#267, objects#268, objects#270, objects#271, objects#283] Various errors in expansion pack objects (original bug). - Fix: [OpenSFX#18] B&M Roar sound effect not looping correctly. diff --git a/src/openrct2/paint/tile_element/Paint.Banner.cpp b/src/openrct2/paint/tile_element/Paint.Banner.cpp index 8b67571b51..06becae32e 100644 --- a/src/openrct2/paint/tile_element/Paint.Banner.cpp +++ b/src/openrct2/paint/tile_element/Paint.Banner.cpp @@ -68,7 +68,7 @@ static void PaintBannerScrollingText( } auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); - auto scroll = (GetGameState().CurrentTicks / 2) % stringWidth; + auto scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK); PaintAddImageAsChild(session, imageId, { 0, 0, height + 22 }, { bbOffset, { 1, 1, 21 } }); }