Handle 0-length byte buffers in micro and nano protobufs

Change-Id: I845ee1ab1005d25c8d77a8c2ed801c0f7b7c847b
pull/345/head
Andre Eisenbach 10 years ago committed by Brian Duff
parent 16a283f794
commit 15bff99de6
  1. 2
      javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java

@ -236,6 +236,8 @@ public final class CodedInputByteBufferNano {
System.arraycopy(buffer, bufferPos, result, 0, size);
bufferPos += size;
return result;
} else if (size == 0) {
return WireFormatNano.EMPTY_BYTES;
} else {
// Slow path: Build a byte array first then copy it.
return readRawBytes(size);

Loading…
Cancel
Save