Fix a bug in MemSegBuffer
This commit is contained in:
parent
a6b81c89ef
commit
0aa2853cf3
@ -299,6 +299,9 @@ class MemSegBuffer extends ResourceSupport<Buffer, MemSegBuffer> implements Buff
|
|||||||
@Override
|
@Override
|
||||||
public Buffer copy(int offset, int length) {
|
public Buffer copy(int offset, int length) {
|
||||||
checkGet(offset, length);
|
checkGet(offset, length);
|
||||||
|
if (length < 0) {
|
||||||
|
throw new IllegalArgumentException("Length cannot be negative: " + length + '.');
|
||||||
|
}
|
||||||
|
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
// Special case zero-length segments, since allocators don't support allocating empty buffers.
|
// Special case zero-length segments, since allocators don't support allocating empty buffers.
|
||||||
|
Loading…
Reference in New Issue
Block a user