Fix crash in WordWrapString

Fixes #3433
This commit is contained in:
Gleb Mazovetskiy 2021-11-07 21:49:56 +00:00 committed by Anders Jenbo
commit e1dc7df3a5

View file

@ -315,7 +315,9 @@ std::string WordWrapString(string_view text, size_t width, GameFontTables size,
}
output.append(processedEnd, end);
output += '\n';
remaining.remove_prefix(lastBreakablePos + lastBreakableLen - (remaining.data() - begin));
// Restart from the beginning of the new line.
remaining = text.substr(lastBreakablePos + lastBreakableLen);
processedEnd = remaining.data();
lastBreakablePos = -1;
lineWidth = 0;