Skip to content

Commit

Permalink
Fixed issue EsotericSoftware#161
Browse files Browse the repository at this point in the history
  • Loading branch information
romix committed Jan 2, 2014
1 parent 9f0bfa7 commit faf05e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/com/esotericsoftware/kryo/io/ByteBufferOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ protected boolean require (int required) throws KryoException {
// Grow buffer.
capacity = Math.min(capacity * 2, maxCapacity);
if (capacity < 0) capacity = maxCapacity;
ByteBuffer newBuffer = ByteBuffer.allocateDirect(capacity);
ByteBuffer newBuffer = (niobuffer != null && !niobuffer.isDirect()) ? ByteBuffer.allocate(capacity) : ByteBuffer
.allocateDirect(capacity);
// Copy the whole buffer
niobuffer.position(0);
newBuffer.put(niobuffer);
Expand Down

0 comments on commit faf05e0

Please sign in to comment.