From bac11e23f6a6f5bba8ddffc41f4c7efe1c220eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 10 Jun 2015 06:39:54 +0200 Subject: [PATCH] avoid an often forgotten NullReferenceException --- OpenRA.Game/Graphics/SpriteFont.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Game/Graphics/SpriteFont.cs b/OpenRA.Game/Graphics/SpriteFont.cs index 804c633b63..63eec66d05 100644 --- a/OpenRA.Game/Graphics/SpriteFont.cs +++ b/OpenRA.Game/Graphics/SpriteFont.cs @@ -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); }