Commit a8129894 authored by Jose Luis Guardiola's avatar Jose Luis Guardiola

Fixed #6563: Incorrect management for invalid files/filestorage/filenode in ml module

parent c3d1f94e
......@@ -3036,6 +3036,7 @@ public:
{
FileStorage fs(filename, FileStorage::READ);
FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
if (fn.empty()) return Ptr<_Tp>();
Ptr<_Tp> obj = _Tp::create();
obj->read(fn);
return !obj->empty() ? obj : Ptr<_Tp>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment