1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-04 22:23:37 +02:00

fixed a splitstring crash with specific string lengths and font sizes

This commit is contained in:
Ellpeck 2019-09-06 11:25:31 +02:00
parent af98526d47
commit e2f9a8ff5d

View file

@ -37,8 +37,10 @@ namespace MLEM.Extensions {
curr.Append(word).Append(' ');
if (widthFunc(curr) * scale >= width) {
var len = curr.Length - word.Length - 1;
total.Append(curr.ToString(0, len - 1)).Append('\n');
curr.Remove(0, len);
if (len > 0) {
total.Append(curr.ToString(0, len - 1)).Append('\n');
curr.Remove(0, len);
}
}
}
total.Append(curr.ToString(0, curr.Length - 1)).Append('\n');