diff --git a/Assets/Mirror/Runtime/Transport/MultiplexTransport.cs b/Assets/Mirror/Runtime/Transport/MultiplexTransport.cs index 806cbfccd..787ae8fa1 100644 --- a/Assets/Mirror/Runtime/Transport/MultiplexTransport.cs +++ b/Assets/Mirror/Runtime/Transport/MultiplexTransport.cs @@ -95,7 +95,7 @@ public override bool ClientConnected() public override void ClientDisconnect() { - if (available != null) + if ((object)available != null) available.ClientDisconnect(); } diff --git a/Assets/Mirror/Tests/MultiplexTest.cs b/Assets/Mirror/Tests/MultiplexTest.cs index ad8e1f8a2..231a33a2d 100644 --- a/Assets/Mirror/Tests/MultiplexTest.cs +++ b/Assets/Mirror/Tests/MultiplexTest.cs @@ -103,5 +103,16 @@ public void TestConnected() Assert.That(transport.ClientConnected()); } + + [Test] + public void TestDisconnect() + { + transport1.Available().Returns(true); + transport.ClientConnect("some.server.com"); + + transport.ClientDisconnect(); + + transport1.Received().ClientDisconnect(); + } } }