Commit 699db2d5 authored by Jisi Liu's avatar Jisi Liu

Merge pull request #345 from brianduff/update_aosp_again

Handle 0-length byte buffers in micro and nano protobufs
parents 03e17044 15bff99d
...@@ -236,6 +236,8 @@ public final class CodedInputByteBufferNano { ...@@ -236,6 +236,8 @@ public final class CodedInputByteBufferNano {
System.arraycopy(buffer, bufferPos, result, 0, size); System.arraycopy(buffer, bufferPos, result, 0, size);
bufferPos += size; bufferPos += size;
return result; return result;
} else if (size == 0) {
return WireFormatNano.EMPTY_BYTES;
} else { } else {
// Slow path: Build a byte array first then copy it. // Slow path: Build a byte array first then copy it.
return readRawBytes(size); return readRawBytes(size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment