Skip to content

Commit

Permalink
Merge pull request #451 from candrews/patch-1
Browse files Browse the repository at this point in the history
Fix get incorrectly handling null bytes
  • Loading branch information
koush committed May 24, 2016
2 parents 8120535 + 0125546 commit 49268eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion AndroidAsync/src/com/koushikdutta/async/ByteBufferList.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,12 @@ public void get(byte[] bytes, int offset, int length) {
while (need > 0) {
ByteBuffer b = mBuffers.peek();
int read = Math.min(b.remaining(), need);
if (bytes != null)
if (bytes != null){
b.get(bytes, offset, read);
} else {
//when bytes is null, just skip data.
b.position(b.position() + read);
}
need -= read;
offset += read;
if (b.remaining() == 0) {
Expand Down

0 comments on commit 49268eb

Please sign in to comment.