move the null check to avoid a crash

This commit is contained in:
Matthias Mailänder
2015-06-13 11:01:55 +02:00
parent b98d98c6d6
commit b58988c623

View File

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