From 32c3482dc558a98543e8b528c080acef17c42746 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 13 Mar 2013 17:30:44 +0000
Subject: [PATCH] BUG: #761 controlDict unreadable

---
 src/OpenFOAM/global/debug/debug.C | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C
index f8f513322c6..479c56db0e8 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));
         }
     }
 
-- 
GitLab