mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Codechange: Assert that max width passed to GetStringHeight is non-zero.
Max width of zero will cause text layouters to crash, potentially after exhausting memory first.
This commit is contained in:
parent
0578b8eaa9
commit
d04fd4602d
@ -693,6 +693,7 @@ int DrawString(int left, int right, int top, StringID str, TextColour colour, St
|
||||
*/
|
||||
int GetStringHeight(std::string_view str, int maxw, FontSize fontsize)
|
||||
{
|
||||
assert(maxw > 0);
|
||||
Layouter layout(str, maxw, TC_FROMSTRING, fontsize);
|
||||
return layout.GetBounds().height;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user