Skip to content

Commit 6ce222b

Browse files
authored
Custom rank update tweaks (#181)
Fix null crash
1 parent 56d5d61 commit 6ce222b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎Essentials/Patches/ChatMessagePatch.cs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ public static void Patch(PatchContext ctx) {
4343

4444
private static bool OnChatMessageReceived_Server(ref ChatMsg msg) {
4545
var Account = PlayerAccountData.GetAccount(msg.Author);
46-
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
47-
if (Rank.DisplayPrefix) {
48-
msg.Author = 0;
49-
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
46+
if (Account != null) {
47+
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
48+
if (Rank.DisplayPrefix) {
49+
msg.Author = 0;
50+
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
51+
}
5052
}
5153
return true;
5254
}

0 commit comments

Comments
 (0)