Added check for mats.empty() on failed image load.

This commit is contained in:
Nathan Graves 2017-02-16 16:46:55 -08:00
parent 2e48ea0a61
commit cfeb82d9fc

View File

@ -81,6 +81,10 @@ NAN_METHOD(OpenCV::ReadImageMulti) {
if (info[0]->IsString()) {
std::string filename = std::string(*Nan::Utf8String(info[0]->ToString()));
cv::imreadmulti(filename, mats);
if (mats.empty()) {
argv[0] = Nan::Error("Error loading file");
}
}
} catch (cv::Exception& e) {
argv[0] = Nan::Error(e.what());