Skip to content

Commit

Permalink
db, bugfix: crash in mongodb.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Sep 29, 2018
1 parent 9be8689 commit 17100aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fibjs/src/db/mongo/MongoCursor.cpp
Expand Up @@ -155,7 +155,7 @@ result_t MongoCursor::forEach(v8::Local<v8::Function> func)
v8::Local<v8::Object> o;
Isolate* isolate = holder();

while ((hr = next(o)) != CALL_RETURN_NULL) {
while ((hr = next(o)) != CALL_RETURN_NULL && hr >= 0) {
v8::Local<v8::Value> a = o;
v8::Local<v8::Value> v = func->Call(v8::Undefined(isolate->m_isolate), 1, &a);

Expand All @@ -175,7 +175,7 @@ result_t MongoCursor::map(v8::Local<v8::Function> func,
v8::Local<v8::Array> as = v8::Array::New(isolate->m_isolate);
int32_t n = 0;

while ((hr = next(o)) != CALL_RETURN_NULL) {
while ((hr = next(o)) != CALL_RETURN_NULL && hr >= 0) {
v8::Local<v8::Value> a = o;
v8::Local<v8::Value> v = func->Call(v8::Undefined(isolate->m_isolate), 1, &a);

Expand Down Expand Up @@ -278,7 +278,7 @@ result_t MongoCursor::toArray(v8::Local<v8::Array>& retVal)
v8::Local<v8::Array> as = v8::Array::New(holder()->m_isolate);
int32_t n = 0;

while ((hr = next(o)) != CALL_RETURN_NULL) {
while ((hr = next(o)) != CALL_RETURN_NULL && hr >= 0) {
as->Set(n, o);
n++;
}
Expand Down

0 comments on commit 17100aa

Please sign in to comment.