diff --git a/src/OpenCV.cc b/src/OpenCV.cc index 329360c..1d6067b 100755 --- a/src/OpenCV.cc +++ b/src/OpenCV.cc @@ -87,7 +87,9 @@ NAN_METHOD(OpenCV::ReadImageMulti) { argv[1] = Nan::Null(); } - Local output = Nan::New(mats.size()); + Local output = Nan::New(mats.size()); + argv[1] = output; + for (std::vector::size_type i = 0; i < mats.size(); i ++) { Local im_h = Nan::New(Matrix::constructor)->GetFunction()->NewInstance(); Matrix *img = Nan::ObjectWrap::Unwrap(im_h); @@ -96,8 +98,6 @@ NAN_METHOD(OpenCV::ReadImageMulti) { output->Set(i, im_h); } - argv[1] = output; - Nan::TryCatch try_catch; cb->Call(Nan::GetCurrentContext()->Global(), 2, argv);