NullReferenceException in hook OnPlayerDeath with custom plugin
Why it sending me error? (it's sending me when i dying from fall or another, but it's sending it not always)  Error:
Failed to call hook 'OnPlayerDeath' on plugin 'MedkitSaver v1.0.0' (NullReferenceException: Object reference not set to an instance of an object
My code:
        object OnPlayerDeath(BasePlayer player, HitInfo info)
        {
            if(player.IsConnected && steamIDs.Contains(player?.IPlayer?.Id?.ToString()))
            {
                DestroyMedkitUi(player);
                steamIDs = steamIDs.Replace(player?.IPlayer?.Id?.ToString(), string.Empty);
            }
            return null;
        }
Could the error be in DestroyMedkitUi()?
        void OnPlayerDeath(BasePlayer player, HitInfo info)
        {
            if(player != null && player.userID.IsSteamId() && player.IsConnected && steamIDs.Contains(player.UserIDString))
            {
                DestroyMedkitUi(player);
                steamIDs = steamIDs.Replace(player.UserIDString, string.Empty);
            }
        }​
5f542b9181eac.png 0x89A
Could the error be in DestroyMedkitUi()?
nope, it's contains only CuiHelper.DestoryUi(player, "gui_name");
Ts3hosting
        void OnPlayerDeath(BasePlayer player, HitInfo info)
        {
            if(player != null && player.userID.IsSteamId() && player.IsConnected && steamIDs.Contains(player.UserIDString))
            {
                DestroyMedkitUi(player);
                steamIDs = steamIDs.Replace(player.UserIDString, string.Empty);
            }
        }​

thanks!!!