diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc index be99229930058c..144de8d238603e 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc @@ -528,8 +528,9 @@ void StatementSync::IterateReturnCallback( LocalVector values(isolate, {Boolean::New(isolate, true), Null(isolate)}); - Local result = - Object::New(isolate, Null(isolate), keys.data(), values.data(), 2); + DCHECK_EQ(keys.size(), values.size()); + Local result = Object::New( + isolate, Null(isolate), keys.data(), values.data(), keys.size()); args.GetReturnValue().Set(result); } @@ -554,8 +555,9 @@ void StatementSync::IterateNextCallback( LocalVector values(isolate, {Boolean::New(isolate, true), Null(isolate)}); - Local result = - Object::New(isolate, Null(isolate), keys.data(), values.data(), 2); + DCHECK_EQ(keys.size(), values.size()); + Local result = Object::New( + isolate, Null(isolate), keys.data(), values.data(), keys.size()); args.GetReturnValue().Set(result); return; } @@ -579,8 +581,9 @@ void StatementSync::IterateNextCallback( LocalVector keys(isolate, {env->done_string(), env->value_string()}); LocalVector values(isolate, {Boolean::New(isolate, false), row}); - Local result = - Object::New(isolate, Null(isolate), keys.data(), values.data(), 2); + DCHECK_EQ(keys.size(), values.size()); + Local result = Object::New( + isolate, Null(isolate), keys.data(), values.data(), keys.size()); args.GetReturnValue().Set(result); } @@ -629,8 +632,9 @@ void StatementSync::Iterate(const FunctionCallbackInfo& args) { .ToLocalChecked() .As(); + DCHECK_EQ(keys.size(), values.size()); Local iterable_iterator = Object::New( - isolate, js_iterator_prototype, keys.data(), values.data(), 2); + isolate, js_iterator_prototype, keys.data(), values.data(), keys.size()); args.GetReturnValue().Set(iterable_iterator); }