diff --git a/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C b/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C index b03dcf1fa0..b3728e56ef 100644 --- a/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C +++ b/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,6 +115,17 @@ void Foam::PtrList::read(Istream& is, const INew& inewt) ) { is.putBack(lastToken); + + if (is.eof()) + { + FatalIOErrorIn + ( + "PtrList::read(Istream&, const INew&)", + is + ) << "Premature EOF after reading " << lastToken.info() + << exit(FatalIOError); + } + sllPtrs.append(inewt(is).ptr()); is >> lastToken; }