1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Merge pull request #21497 from ZehMatt/fix-bannercrash

Fix regression from #21474 due to use-after-free bug
This commit is contained in:
Matt
2024-03-02 04:30:36 +02:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -51,9 +51,9 @@ void Banner::FormatTextTo(Formatter& ft, bool addColour) const
if (addColour)
{
auto formatToken = FormatTokenFromTextColour(text_colour);
auto tokenText = FormatTokenToStringWithBraces(formatToken);
formattedTextBuffer = FormatTokenToStringWithBraces(formatToken);
ft.Add<StringId>(STR_STRING_STRINGID);
ft.Add<const char*>(tokenText.data());
ft.Add<const char*>(formattedTextBuffer.data());
}
FormatTextTo(ft);

View File

@@ -36,6 +36,7 @@ struct Banner
ObjectEntryIndex type = BANNER_NULL;
uint8_t flags{};
std::string text;
mutable std::string formattedTextBuffer;
uint8_t colour{};
RideId ride_index{};
uint8_t text_colour{};