Skip to content

Commit

Permalink
fix: stopping null ref in disconnect
Browse files Browse the repository at this point in the history
Player should never be null in Peer_OnDisconnected, but adding null check just incase earlier Exception causes player to not be created
  • Loading branch information
James-Frowen committed May 24, 2021
1 parent e8a93a4 commit 4d0f092
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/Mirage/Runtime/NetworkClient.cs
Expand Up @@ -153,7 +153,7 @@ private void Peer_OnConnectionFailed(SocketLayer.IConnection conn, RejectReason
private void Peer_OnDisconnected(SocketLayer.IConnection conn, DisconnectReason reason)
{
if (logger.LogEnabled()) logger.Log($"Disconnected from {conn.EndPoint} with reason {reason}");
Player.MarkAsDisconnected();
Player?.MarkAsDisconnected();
// todo add reason to disconnected event
// use different enum, so that:
// - user doesn't need to add reference to socket layer
Expand Down

0 comments on commit 4d0f092

Please sign in to comment.