Skip to content

Commit cd6bd79

Browse files
committed
fix: Stop notifying disconnect if connection doesn't exist
1 parent 09d0874 commit cd6bd79

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Assets/EOSTransport/Runtime/EOSTransport.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,11 @@ void OnRemoteConnected(int connectionId)
214214

215215
void OnRemoteDisconnected(int connectionId, DisconnectReason reason)
216216
{
217-
_connections.Remove(new Connection(connectionId));
218-
onDisconnected?.Invoke(new Connection(connectionId), reason, true);
217+
var connection = new Connection(connectionId);
218+
if (!_connections.Remove(connection))
219+
return;
220+
221+
onDisconnected?.Invoke(connection, reason, true);
219222
}
220223

221224
void OnServerData(int connectionId, ByteData data)

0 commit comments

Comments
 (0)