From b0edb8a3f90f94cc549aada1399e7540f7267e0a Mon Sep 17 00:00:00 2001
From: ext-calvo_p <pedro.calvo@ciemat.es>
Date: Fri, 27 Nov 2020 14:20:26 +0100
Subject: [PATCH] failed file read condition

---
 src/Distribution/Distribution.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Distribution/Distribution.cpp b/src/Distribution/Distribution.cpp
index 3821f1b1c..160e4ffec 100644
--- a/src/Distribution/Distribution.cpp
+++ b/src/Distribution/Distribution.cpp
@@ -1013,11 +1013,11 @@ void Distribution::createDistributionFromFile(size_t /*numberOfParticles*/, doub
     std::string fileName = Attributes::getString(itsAttr[Attrib::Distribution::FNAME]);
     if (Ippl::myNode() == 0) {
         inputFile.open(fileName.c_str());
-        if (inputFile.fail())
-            throw OpalException("Distribution::createDistributionFromFile",
-                                "Open file operation failed, please check if \""
-                                + fileName
-                                + "\" really exists.");
+    }
+    if (inputFile.fail()) {
+        throw OpalException("Distribution::createDistributionFromFile",
+                            "Open file operation failed, please check if \""
+                            + fileName + "\" really exists.");
     }
 
     size_t numberOfParticlesRead = getNumberOfParticlesInFile(inputFile);
-- 
GitLab