Permalink
Browse files

Merge remote-tracking branch 'tammofreese/master'

Signed-off-by: Brenden Grace <brenden.grace@gmail.com>
  • Loading branch information...
2 parents f2ce7ba + 4b0b8cc commit 97c6b298be3920924ef95e56a70c2a47cf6c8afd @bcg committed Jul 19, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/em-mongo/connection.rb
@@ -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

0 comments on commit 97c6b29

Please sign in to comment.