Fix cppcheck 1.64 warnings
[alexxy/gromacs.git] / src / gromacs / utility / exceptions.cpp
index 6dfc4330d83324b7c35ffc3d8d32beadb9d98f71..bf0566d875c73f3dd89740c224f970b746b53e36 100644 (file)
@@ -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)