1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01: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(' '); curr.Append(word).Append(' ');
if (widthFunc(curr) * scale >= width) { if (widthFunc(curr) * scale >= width) {
var len = curr.Length - word.Length - 1; var len = curr.Length - word.Length - 1;
total.Append(curr.ToString(0, len - 1)).Append('\n'); if (len > 0) {
curr.Remove(0, len); total.Append(curr.ToString(0, len - 1)).Append('\n');
curr.Remove(0, len);
}
} }
} }
total.Append(curr.ToString(0, curr.Length - 1)).Append('\n'); total.Append(curr.ToString(0, curr.Length - 1)).Append('\n');