Skip to content

Commit c46eb73

Browse files
committed
Slight improvement for avoiding array creation if not necessary.
1 parent 1363505 commit c46eb73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

netty/src/main/java/io/grpc/netty/NettyReadableBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public boolean canUseByteBuffer() {
111111

112112
@Override
113113
public ByteBuffer getByteBuffer() {
114-
return buffer.nioBuffers()[0];
114+
return buffer.nioBufferCount() == 1 ? buffer.nioBuffer() : buffer.nioBuffers()[0];
115115
}
116116

117117
/**

0 commit comments

Comments
 (0)