From 3e59b3f72e1535bdc30e66ebc551033bee8eeb1e Mon Sep 17 00:00:00 2001 From: mrmbernardi Date: Wed, 24 Jul 2024 17:51:10 +1000 Subject: [PATCH] Fix #22339: Printing ui.tool.cursor in console crashes the game. (#22347) --- distribution/changelog.txt | 1 + src/openrct2-ui/scripting/CustomMenu.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 7792ed537b..0c3a34bc7e 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Fix: [#22304] Graphs don't draw lines on the left edge of the screen. - Fix: [#22318] Water sparkles are missing if transparent water is enabled without RCT1 linked. - Fix: [#22333] Tile inspector closes other tool windows. +- Fix: [#22339] Printing ui.tool.cursor in console crashes the game. - Fix: [#22348] Progress bar screen doesn't handle window resizing. 0.4.12 (2024-07-07) diff --git a/src/openrct2-ui/scripting/CustomMenu.cpp b/src/openrct2-ui/scripting/CustomMenu.cpp index 4f48daed29..c9821dea16 100644 --- a/src/openrct2-ui/scripting/CustomMenu.cpp +++ b/src/openrct2-ui/scripting/CustomMenu.cpp @@ -86,9 +86,9 @@ namespace OpenRCT2::Scripting { auto str = CursorNames[value]; duk_push_lstring(ctx, str.data(), str.size()); - DukValue::take_from_stack(ctx); + return DukValue::take_from_stack(ctx); } - return {}; + return ToDuk(ctx, undefined); } template<> CursorID FromDuk(const DukValue& s)