avoid an often forgotten NullReferenceException

This commit is contained in:
Matthias Mailänder
2015-06-10 06:39:54 +02:00
parent e5f89c2339
commit bac11e23f6

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);
}