From 606a5fd537ac3f566bdb98ea0c4267e3db070899 Mon Sep 17 00:00:00 2001 From: LaurentBerger Date: Mon, 27 Nov 2017 13:13:05 +0100 Subject: [PATCH] Try to solve issue 10166 --- modules/core/include/opencv2/core.hpp | 1 + modules/ml/src/ann_mlp.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 8054d31..177ffbe 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -3134,6 +3134,7 @@ public: template static Ptr<_Tp> load(const String& filename, const String& objname=String()) { FileStorage fs(filename, FileStorage::READ); + CV_Assert(fs.isOpened()); FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname]; if (fn.empty()) return Ptr<_Tp>(); Ptr<_Tp> obj = _Tp::create(); diff --git a/modules/ml/src/ann_mlp.cpp b/modules/ml/src/ann_mlp.cpp index fdc73d9..a55ed22 100644 --- a/modules/ml/src/ann_mlp.cpp +++ b/modules/ml/src/ann_mlp.cpp @@ -1329,7 +1329,7 @@ Ptr ANN_MLP::load(const String& filepath) { FileStorage fs; fs.open(filepath, FileStorage::READ); - + CV_Assert(fs.isOpened()); Ptr ann = makePtr(); ((ANN_MLPImpl*)ann.get())->read(fs.getFirstTopLevelNode()); -- 2.7.4