diff options
author | Jisi Liu <liujisi@google.com> | 2015-05-07 13:13:10 -0700 |
---|---|---|
committer | Jisi Liu <liujisi@google.com> | 2015-05-07 13:13:10 -0700 |
commit | 699db2d51a747abecf9c2b4a28bff7effb51fa6d (patch) | |
tree | 14845be1fc7aeae5bf0fb7e85e488af0322758fe /javanano/src/main | |
parent | 03e170446b5d695de0c7a3c8f31dc4f2bf49bfc4 (diff) | |
parent | 15bff99de644be9ebccb0c4cfbce9dceea273abe (diff) | |
download | protobuf-699db2d51a747abecf9c2b4a28bff7effb51fa6d.tar.gz protobuf-699db2d51a747abecf9c2b4a28bff7effb51fa6d.tar.bz2 protobuf-699db2d51a747abecf9c2b4a28bff7effb51fa6d.zip |
Merge pull request #345 from brianduff/update_aosp_again
Handle 0-length byte buffers in micro and nano protobufs
Diffstat (limited to 'javanano/src/main')
-rw-r--r-- | javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java b/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java index 4b45c6d2..f3993155 100644 --- a/javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java +++ b/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); |