Skip to content

Commit

Permalink
Fixed Output#writeBytes when capacity is zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Feb 28, 2019
1 parent e189132 commit 2824ca9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/com/esotericsoftware/kryo/io/Output.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.esotericsoftware.kryo.KryoException;
import com.esotericsoftware.kryo.util.Pool.Poolable;
import com.esotericsoftware.kryo.util.Pool;
import com.esotericsoftware.kryo.util.Util;

import java.io.IOException;
Expand Down Expand Up @@ -266,9 +265,10 @@ public void writeBytes (byte[] bytes, int offset, int count) throws KryoExceptio
System.arraycopy(bytes, offset, buffer, position, copyCount);
position += copyCount;
count -= copyCount;
System.out.println(copyCount);
if (count == 0) return;
offset += copyCount;
copyCount = Math.min(capacity, count);
copyCount = Math.min(Math.max(capacity, 1), count);
require(copyCount);
}
}
Expand Down

0 comments on commit 2824ca9

Please sign in to comment.