Make sending net messages while disconnected on client log an error.

This commit is contained in:
PJB3005
2025-09-16 18:57:53 +02:00
parent 0c691b061d
commit 058821c08b
2 changed files with 4 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ END TEMPLATE-->
### Other
*None yet*
* The client now logs an error when attempting to send a network message without server connection. Previously, it would be silently dropped.
### Internal

View File

@@ -1106,7 +1106,10 @@ namespace Robust.Shared.Network
// not connected to a server, so a message cannot be sent to it.
if (!IsConnected)
{
_logger.Error($"Tried to send message while not connected to a server: {message}\n{Environment.StackTrace}");
return;
}
DebugTools.Assert(_netPeers.Count == 1);
DebugTools.Assert(_netPeers[0].Channels.Count == 1);