mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-29 15:58:33 +01:00
fixed a splitstring crash with specific string lengths and font sizes
This commit is contained in:
parent
af98526d47
commit
e2f9a8ff5d
1 changed files with 4 additions and 2 deletions
|
@ -37,10 +37,12 @@ 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;
|
||||||
|
if (len > 0) {
|
||||||
total.Append(curr.ToString(0, len - 1)).Append('\n');
|
total.Append(curr.ToString(0, len - 1)).Append('\n');
|
||||||
curr.Remove(0, len);
|
curr.Remove(0, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
total.Append(curr.ToString(0, curr.Length - 1)).Append('\n');
|
total.Append(curr.ToString(0, curr.Length - 1)).Append('\n');
|
||||||
}
|
}
|
||||||
return total.ToString(0, total.Length - 1);
|
return total.ToString(0, total.Length - 1);
|
||||||
|
|
Loading…
Reference in a new issue