diff --git a/protocol/src/main/resources/cs/Buffer/ByteBuffer.cs b/protocol/src/main/resources/cs/Buffer/ByteBuffer.cs index faf82c58..cfd6f428 100644 --- a/protocol/src/main/resources/cs/Buffer/ByteBuffer.cs +++ b/protocol/src/main/resources/cs/Buffer/ByteBuffer.cs @@ -58,7 +58,7 @@ namespace CsProtocol.Buffer public void SetWriteOffset(int writeIndex) { - if (writeOffset > buffer.Length) + if (writeIndex > buffer.Length) { throw new Exception("writeIndex[" + writeIndex + "] out of bounds exception: readerIndex: " + readOffset + ", writerIndex: " + writeOffset + diff --git a/protocol/src/test/resources/csTest/CsProtocol/Buffer/ByteBuffer.cs b/protocol/src/test/resources/csTest/CsProtocol/Buffer/ByteBuffer.cs index a86da2ef..0a1257ac 100644 --- a/protocol/src/test/resources/csTest/CsProtocol/Buffer/ByteBuffer.cs +++ b/protocol/src/test/resources/csTest/CsProtocol/Buffer/ByteBuffer.cs @@ -56,7 +56,7 @@ namespace CsProtocol.Buffer public void SetWriteOffset(int writeIndex) { - if (writeOffset > buffer.Length) + if (writeIndex > buffer.Length) { throw new Exception("writeIndex[" + writeIndex + "] out of bounds exception: readerIndex: " + readOffset + ", writerIndex: " + writeOffset +