checking if incoming message has length 0 before checking its id (#2336)

This commit is contained in:
James Frowen 2020-10-18 22:07:10 +01:00 committed by GitHub
parent e368284f8e
commit 25be44840e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,6 +265,12 @@ public bool InvokeHandler<T>(T msg, int channelId) where T : NetworkMessage
/// <param name="buffer">The data received.</param> /// <param name="buffer">The data received.</param>
internal void TransportReceive(ArraySegment<byte> buffer, int channelId) internal void TransportReceive(ArraySegment<byte> buffer, int channelId)
{ {
if (buffer.Count == 0)
{
logger.LogError($"ConnectionRecv {this} Message was empty");
return;
}
// unpack message // unpack message
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(buffer)) using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(buffer))
{ {