From d4d1d32937c8c31e6906daf7f0e048e1c8fa5333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 1 Oct 2016 12:06:04 +0200 Subject: [PATCH] GUI: use early return --- gui/project.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/gui/project.cpp b/gui/project.cpp index 454b5d042..67060b557 100644 --- a/gui/project.cpp +++ b/gui/project.cpp @@ -65,21 +65,22 @@ bool Project::IsOpen() const bool Project::Open() { mPFile = new ProjectFile(mFilename, this); - if (QFile::exists(mFilename)) { - if (!mPFile->Read()) { - QMessageBox msg(QMessageBox::Critical, - tr("Cppcheck"), - tr("Could not read the project file."), - QMessageBox::Ok, - mParentWidget); - msg.exec(); - mFilename = QString(); - mPFile->SetFilename(mFilename); - return false; - } - return true; + if (!QFile::exists(mFilename)) + return false; + + if (!mPFile->Read()) { + QMessageBox msg(QMessageBox::Critical, + tr("Cppcheck"), + tr("Could not read the project file."), + QMessageBox::Ok, + mParentWidget); + msg.exec(); + mFilename = QString(); + mPFile->SetFilename(mFilename); + return false; } - return false; + + return true; } bool Project::Edit()