mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkReader.ReadBytesSegment: use .Remaining
This commit is contained in:
parent
98be66ec13
commit
78fb0b57ae
@ -162,8 +162,8 @@ public byte[] ReadBytes(byte[] bytes, int count)
|
||||
/// <summary>Read 'count' bytes allocation-free as ArraySegment that points to the internal array.</summary>
|
||||
public ArraySegment<byte> ReadBytesSegment(int count)
|
||||
{
|
||||
// check if within buffer limits
|
||||
if (Position + count > buffer.Count)
|
||||
// ensure remaining
|
||||
if (Remaining < count)
|
||||
{
|
||||
throw new EndOfStreamException($"ReadBytesSegment can't read {count} bytes because it would read past the end of the stream. {ToString()}");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user