Skip to content

Commit 606a5fd

Browse files
committed
Try to solve issue 10166
1 parent f8ad289 commit 606a5fd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

modules/core/include/opencv2/core.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,7 @@ class CV_EXPORTS_W Algorithm
31343134
template<typename _Tp> static Ptr<_Tp> load(const String& filename, const String& objname=String())
31353135
{
31363136
FileStorage fs(filename, FileStorage::READ);
3137+
CV_Assert(fs.isOpened());
31373138
FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
31383139
if (fn.empty()) return Ptr<_Tp>();
31393140
Ptr<_Tp> obj = _Tp::create();

modules/ml/src/ann_mlp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ Ptr<ANN_MLP> ANN_MLP::load(const String& filepath)
13291329
{
13301330
FileStorage fs;
13311331
fs.open(filepath, FileStorage::READ);
1332-
1332+
CV_Assert(fs.isOpened());
13331333
Ptr<ANN_MLP> ann = makePtr<ANN_MLPImpl>();
13341334

13351335
((ANN_MLPImpl*)ann.get())->read(fs.getFirstTopLevelNode());

0 commit comments

Comments
 (0)