[#1782] Fix IndexOutOfBoundException with direct buffer and gathering writes

This commit is contained in:
Norman Maurer 2013-08-24 18:16:05 +02:00
parent 005d33a761
commit f76c01c3aa

View File

@ -336,7 +336,7 @@ public final class ChannelOutboundBuffer {
nioBuffers[nioBufferCount ++] = buf.internalNioBuffer(readerIndex, readableBytes); nioBuffers[nioBufferCount ++] = buf.internalNioBuffer(readerIndex, readableBytes);
} else { } else {
ByteBuffer[] nioBufs = buf.nioBuffers(); ByteBuffer[] nioBufs = buf.nioBuffers();
if (nioBufferCount + nioBufs.length == nioBuffers.length + 1) { if (nioBufferCount + nioBufs.length > nioBuffers.length) {
this.nioBuffers = nioBuffers = doubleNioBufferArray(nioBuffers, nioBufferCount); this.nioBuffers = nioBuffers = doubleNioBufferArray(nioBuffers, nioBufferCount);
} }
for (ByteBuffer nioBuf: nioBufs) { for (ByteBuffer nioBuf: nioBufs) {