diff --git a/Server/Server.cs b/Server/Server.cs index 9082189..9d2f4a2 100644 --- a/Server/Server.cs +++ b/Server/Server.cs @@ -299,6 +299,7 @@ public class Server { } close: + bool wasConnected = client.Connected; // Clients.Remove(client) client.Connected = false; try { @@ -307,8 +308,10 @@ public class Server { catch { /*lol*/ } #pragma warning disable CS4014 - Task.Run(() => Broadcast(new DisconnectPacket(), client)) - .ContinueWith(x => { if (x.Exception != null) { Logger.Error(x.Exception.ToString()); } }); + if (wasConnected) { + Task.Run(() => Broadcast(new DisconnectPacket(), client)) + .ContinueWith(x => { if (x.Exception != null) { Logger.Error(x.Exception.ToString()); } }); + } #pragma warning restore CS4014 }