fix: reading chunks from an empty (zero-length) grid-stored file
reading chunks from an empty file caused an endless loop
This commit is contained in:
parent
3cb1e4644b
commit
6e66b11f6e
|
@ -251,8 +251,9 @@ module Mongo
|
|||
# @return [Mongo::GridIO] self
|
||||
def each
|
||||
return read_all unless block_given?
|
||||
while chunk = read(chunk_size)
|
||||
while chunk = read(chunk_size)
|
||||
yield chunk
|
||||
break if chunk.empty?
|
||||
end
|
||||
self
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue