From 9f7fbb0cbece6caacf08905f175d99a4647a7e91 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Wed, 17 Oct 2018 23:48:00 +0300 Subject: [PATCH] Fixed client error reporting --- .../BarotraumaClient/Source/Networking/GameClient.cs | 1 + .../BarotraumaShared/Source/Networking/GameServer.cs | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index ef11cde37..08897f112 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -1650,6 +1650,7 @@ namespace Barotrauma.Networking public void ReportError(ClientNetError error,UInt16 expectedID=0,UInt16 eventID=0,UInt16 entityID=0) { NetOutgoingMessage outMsg = client.CreateMessage(); + outMsg.Write((byte)ClientPacketHeader.ERROR); outMsg.Write((byte)error); switch (error) { diff --git a/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs index 2eb44d022..0989ffc84 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs @@ -648,8 +648,15 @@ namespace Barotrauma.Networking break; } - GameServer.Log(c.Name+" has reported an error: "+errorStr, ServerLog.MessageType.Error); - KickClient(c, errorStr); + if (c == null) + { + KickClient(inc.SenderConnection, errorStr); + } + else + { + GameServer.Log(c.Name + " has reported an error: " + errorStr, ServerLog.MessageType.Error); + KickClient(c, errorStr); + } } private void ClientReadLobby(NetIncomingMessage inc)