From 7c4c0b628b180e9549e20f6f8e1196fc67856559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Zmys=C5=82owski?= Date: Fri, 25 Nov 2011 07:42:16 +0100 Subject: [PATCH] Fixed #3216 (GUI: Crash when cancel is clicked in the New Project dialog) --- gui/mainwindow.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 134e06c7c..fb31dcafe 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -880,17 +880,19 @@ void MainWindow::NewProjectFile() QString(), filter); - if (!filepath.isEmpty()) { - EnableProjectActions(true); - QFileInfo inf(filepath); - const QString filename = inf.fileName(); - FormatAndSetTitle(tr("Project:") + QString(" ") + filename); + if (filepath.isEmpty()) + return; + + EnableProjectActions(true); + QFileInfo inf(filepath); + const QString filename = inf.fileName(); + FormatAndSetTitle(tr("Project:") + QString(" ") + filename); + + delete mProject; + mProject = new Project(filepath, this); + mProject->Create(); + mProject->Edit(); - delete mProject; - mProject = new Project(filepath, this); - mProject->Create(); - mProject->Edit(); - } AddProjectMRU(filepath); CheckProject(mProject); }