dictionaryListEntryIO: Trap errors when reading entries in the list

Resolves bug-report https://bugs.openfoam.org/view.php?id=2984
This commit is contained in:
Henry Weller
2018-06-18 10:24:29 +01:00
parent ee4ed5d942
commit eca187e025
2 changed files with 16 additions and 5 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,7 +66,12 @@ Foam::dictionaryListEntry::dictionaryListEntry
for (label i=0; i<s; i++)
{
entry::New(*this, is);
if (!entry::New(*this, is))
{
FatalIOErrorInFunction(is)
<< "Failed to read dictionary entry in list"
<< exit(FatalIOError);
}
}
is.readEndList("List");
}
@ -88,7 +93,13 @@ Foam::dictionaryListEntry::dictionaryListEntry
break;
}
is.putBack(nextToken);
entry::New(*this, is);
if (!entry::New(*this, is))
{
FatalIOErrorInFunction(is)
<< "Failed to read dictionary entry in list"
<< exit(FatalIOError);
}
}
}
else

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,7 +139,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
// Otherwise the token is invalid
cerr<< "--> FOAM Warning : " << std::endl
<< " From function "
<< "entry::getKeyword(keyType&, Istream&)" << std::endl
<< "entry::New(dictionary&, Istream&)" << std::endl
<< " in file " << __FILE__
<< " at line " << __LINE__ << std::endl
<< " Reading " << is.name().c_str() << std::endl