Merge pull request #8471 from Mailaender/name-length-nre

Fixed a NullReferenceException in SanitizedPlayerName
This commit is contained in:
Pavel Penev
2015-06-13 14:06:38 +03:00

View File

@@ -334,13 +334,13 @@ namespace OpenRA
var clean = SanitizedName(dirty);
if (string.IsNullOrWhiteSpace(clean) || forbiddenNames.Contains(clean) || botNames.Contains(clean))
clean = new PlayerSettings().Name;
// avoid UI glitches
if (clean.Length > 16)
clean = clean.Substring(0, 16);
if (string.IsNullOrWhiteSpace(clean) || forbiddenNames.Contains(clean) || botNames.Contains(clean))
clean = new PlayerSettings().Name;
return clean;
}