diff --git a/Subsurface/Source/Networking/NetEntityEvent/NetEntityEventManager.cs b/Subsurface/Source/Networking/NetEntityEvent/NetEntityEventManager.cs index 2bb2b91f9..b304b8cc1 100644 --- a/Subsurface/Source/Networking/NetEntityEvent/NetEntityEventManager.cs +++ b/Subsurface/Source/Networking/NetEntityEvent/NetEntityEventManager.cs @@ -30,7 +30,16 @@ namespace Barotrauma.Networking { //write into a temporary buffer so we can write the length before the actual data NetBuffer tempBuffer = new NetBuffer(); - WriteEvent(tempBuffer, e, recipient); + try + { + WriteEvent(tempBuffer, e, recipient); + } + + catch (Exception exception) + { + DebugConsole.ThrowError("Failed to write an event for the entity \""+e.Entity+"\"", exception); + continue; + } Debug.Assert( tempBuffer.LengthBytes < 128, diff --git a/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs b/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs index f497600db..8d875250c 100644 --- a/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs +++ b/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs @@ -78,7 +78,7 @@ namespace Barotrauma.Networking { //we already have an identical event that's waiting to be sent // -> no need to add a new one - if (events[i].IsDuplicate(newEvent)) return; + if (events[i].IsDuplicate(newEvent) && !events[i].Sent) return; } ID++;