avoid an often forgotten NullReferenceException
This commit is contained in:
@@ -93,6 +93,9 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public int2 Measure(string text)
|
public int2 Measure(string text)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(text))
|
||||||
|
return int2.Zero;
|
||||||
|
|
||||||
var lines = text.Split('\n');
|
var lines = text.Split('\n');
|
||||||
return new int2((int)Math.Ceiling(lines.Max(lineWidth)), lines.Length * size);
|
return new int2((int)Math.Ceiling(lines.Max(lineWidth)), lines.Length * size);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user