Skip to content

Commit c8c124b

Browse files
committed
Added some more safety for CustomInfo
1 parent 7fce843 commit c8c124b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

UncomplicatedCustomRoles/API/Features/CustomInfo.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ public void UpdateInfo(Player player)
132132
else
133133
{
134134
string nick = Nickname?.Replace("<color=#855439>*</color>", "") ?? string.Empty;
135+
if (string.IsNullOrEmpty(nick))
136+
nick = player.Nickname;
135137
string color = colorfulNickname.Color.StartsWith("#") ? colorfulNickname.Color : $"#{colorfulNickname.Color}";
136138
if (!Misc.AcceptedColours.Contains(color.Replace("#", "")))
137139
LogManager.Warn($"The color {color} is not acceptable by the game in ColorfulNicknames! Please use a valid hex color code.");
@@ -155,6 +157,13 @@ public void UpdateInfo(Player player)
155157

156158
if (string.IsNullOrEmpty(rawNickname))
157159
rawNickname = player.Nickname;
160+
161+
if (string.IsNullOrEmpty(rawInfo) && string.IsNullOrEmpty(rawRole) && string.IsNullOrEmpty(player.Nickname))
162+
{
163+
player.InfoArea |= PlayerInfoArea.Nickname | PlayerInfoArea.Role | PlayerInfoArea.UnitName;
164+
player.CustomInfo = string.Empty;
165+
return;
166+
}
158167

159168
player.CustomInfo = rawCustomInfo.Replace("%%", "%\n%").BulkReplace(new()
160169
{

0 commit comments

Comments
 (0)