Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / utility / exceptions.cpp
index 6dfc4330d83324b7c35ffc3d8d32beadb9d98f71..952383ffad3c4b86f003be6a2063ed8c422ddb06 100644 (file)
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_utility
  */
+#include "gmxpre.h"
+
 #include "exceptions.h"
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <cstring>
 
@@ -51,8 +51,8 @@
 #include <stdexcept>
 #include <typeinfo>
 
-#include <boost/exception/get_error_info.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/exception/get_error_info.hpp>
 
 #include "thread_mpi/system_error.h"
 
@@ -176,11 +176,15 @@ GromacsException::GromacsException(const ExceptionInitializer &details)
 const char *GromacsException::what() const throw()
 {
     const ErrorMessage *msg = boost::get_error_info<errinfo_message>(*this);
-    while (msg != NULL && msg->isContext())
+    if (msg == NULL)
+    {
+        return "No reason provided";
+    }
+    while (msg->isContext())
     {
         msg = &msg->child();
     }
-    return msg != NULL ? msg->text().c_str() : "No reason provided";
+    return msg->text().c_str();
 }
 
 void GromacsException::prependContext(const std::string &context)