1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Fix regression from #21474 due to use-after-free bug

This commit is contained in:
ζeh Matt
2024-03-02 03:50:27 +02:00
parent 5aed126cac
commit c9ac9784ed
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{};