Skip to content
Prev Previous commit
Next Next commit
Fixed null crash
  • Loading branch information
Bishbash777 authored and Bishbash777 committed Mar 16, 2021
commit 59cbf0bd3a09aee618d1faaa780f1d7e7611fcdc
10 changes: 6 additions & 4 deletions Essentials/Patches/ChatMessagePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ public static void Patch(PatchContext ctx) {

private static bool OnChatMessageReceived_Server(ref ChatMsg msg) {
var Account = PlayerAccountData.GetAccount(msg.Author);
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
if (Rank.DisplayPrefix) {
msg.Author = 0;
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
if (Account != null) {
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
if (Rank.DisplayPrefix) {
msg.Author = 0;
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
}
}
return true;
}
Expand Down