Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed Issue #40

  • Loading branch information...
commit 4b0b8cc82dd18b74ecb92bd06150287b2d456a33 1 parent f2ce7ba
Tammo Freese authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/em-mongo/connection.rb
8 lib/em-mongo/connection.rb
View
@@ -164,9 +164,11 @@ def receive_data(data)
end
if @buffer.more?
- remaining_bytes= @buffer.size-@buffer.position
- @buffer = BSON::ByteBuffer.new(@buffer.to_s[@buffer.position,remaining_bytes])
- @buffer.rewind
+ if @buffer.position > 0
+ remaining_bytes= @buffer.size-@buffer.position
+ @buffer = BSON::ByteBuffer.new(@buffer.to_s[@buffer.position,remaining_bytes])
+ @buffer.rewind
+ end
else
@buffer.clear
end
Please sign in to comment.
Something went wrong with that request. Please try again.