From 13b5c026d284901876f6d17a93414fd59a2c2d31 Mon Sep 17 00:00:00 2001 From: Karl Essinger Date: Mon, 25 Jul 2022 19:23:34 +0200 Subject: [PATCH] Fix rare exception --- .../EventListeners/PlayerEventListener.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/SCPDiscordPlugin/EventListeners/PlayerEventListener.cs b/SCPDiscordPlugin/EventListeners/PlayerEventListener.cs index 13945d1c..f80438b6 100644 --- a/SCPDiscordPlugin/EventListeners/PlayerEventListener.cs +++ b/SCPDiscordPlugin/EventListeners/PlayerEventListener.cs @@ -807,17 +807,17 @@ public void OnGrenadeHitPlayer(PlayerGrenadeHitPlayer ev) Dictionary variables = new Dictionary { { "playeripaddress", ev.Player.IPAddress }, - { "playername", ev.Player.Name }, - { "playerplayerid", ev.Player.PlayerID.ToString() }, - { "playersteamid", ev.Player.GetParsedUserID() ?? ev.Player.UserID }, - { "playerclass", ev.Player.PlayerRole.RoleID.ToString() }, - { "playerteam", ev.Player.PlayerRole.Team.ToString() }, - { "targetipaddress", ev.Victim.IPAddress }, - { "targetname", ev.Victim.Name }, - { "targetplayerid", ev.Victim.PlayerID.ToString() }, - { "targetsteamid", ev.Victim.GetParsedUserID() ?? ev.Player.UserID }, - { "targetclass", ev.Victim.PlayerRole.RoleID.ToString() }, - { "targetteam", ev.Victim.PlayerRole.Team.ToString() }, + { "playername", ev.Player?.Name }, + { "playerplayerid", ev.Player?.PlayerID.ToString() }, + { "playersteamid", ev.Player?.GetParsedUserID() ?? ev.Player?.UserID }, + { "playerclass", ev.Player?.PlayerRole.RoleID.ToString() }, + { "playerteam", ev.Player?.PlayerRole.Team.ToString() }, + { "targetipaddress", ev.Victim?.IPAddress }, + { "targetname", ev.Victim?.Name }, + { "targetplayerid", ev.Victim?.PlayerID.ToString() }, + { "targetsteamid", ev.Victim?.GetParsedUserID() ?? ev.Victim?.UserID }, + { "targetclass", ev.Victim?.PlayerRole.RoleID.ToString() }, + { "targetteam", ev.Victim?.PlayerRole.Team.ToString() }, }; this.plugin.SendMessage(Config.GetArray("channels.ongrenadehitplayer"), "player.ongrenadehitplayer", variables); }