diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index f8f513322c6d821cd5e39b7721cbfd57da2d770a..479c56db0e8787e583b92c80e865086921ea043d 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.C @@ -95,10 +95,18 @@ Foam::dictionary& Foam::debug::controlDict() controlDictPtr_ = new dictionary(); forAllReverse(controlDictFiles, cdfi) { - controlDictPtr_->merge - ( - dictionary(IFstream(controlDictFiles[cdfi])()) - ); + IFstream ifs(controlDictFiles[cdfi]); + + if (!ifs.good()) + { + SafeFatalIOErrorIn + ( + "debug::controlDict()", + ifs, + "Cannot open controlDict" + ); + } + controlDictPtr_->merge(dictionary(ifs)); } }