diff --git a/LiteNetLib/NetManager.HashSet.cs b/LiteNetLib/NetManager.HashSet.cs index 72181aca..a3c22040 100644 --- a/LiteNetLib/NetManager.HashSet.cs +++ b/LiteNetLib/NetManager.HashSet.cs @@ -85,6 +85,11 @@ private void ClearPeerSet() private bool ContainsPeer(NetPeer item) { + if (item == null) + { + NetDebug.WriteError($"Contains peer null: {item}"); + return false; + } if (_buckets != null) { int hashCode = item.GetHashCode() & Lower31BitMask; @@ -121,6 +126,11 @@ public bool TryGetPeerById(int id, out NetPeer peer) private void AddPeer(NetPeer peer) { + if (peer == null) + { + NetDebug.WriteError($"Add peer null: {peer}"); + return; + } _peersLock.EnterWriteLock(); if (_headPeer != null) { @@ -149,6 +159,11 @@ private void RemovePeer(NetPeer peer) private void RemovePeerInternal(NetPeer peer) { + if (peer == null) + { + NetDebug.WriteError($"Remove peer null: {peer}"); + return; + } if (!RemovePeerFromSet(peer)) return; if (peer == _headPeer) diff --git a/LiteNetLibSampleUnity/Assets/LiteNetLib.dll b/LiteNetLibSampleUnity/Assets/LiteNetLib.dll index 50fce6aa..b3d71a58 100644 Binary files a/LiteNetLibSampleUnity/Assets/LiteNetLib.dll and b/LiteNetLibSampleUnity/Assets/LiteNetLib.dll differ