Merge pull request #8457 from Mailaender/spritefont-measure-nre

Fixed a common NullReferenceException at SpriteFont.Measure
This commit is contained in:
Oliver Brakmann
2015-06-10 22:54:10 +02:00

View File

@@ -93,6 +93,9 @@ namespace OpenRA.Graphics
public int2 Measure(string text)
{
if (string.IsNullOrEmpty(text))
return int2.Zero;
var lines = text.Split('\n');
return new int2((int)Math.Ceiling(lines.Max(lineWidth)), lines.Length * size);
}