[vlmc-devel] [PATCH] [PATCH] Ensure the WelcomePage to choose an existing project

Yikai Lu luyikei.qmltu at gmail.com
Sat Mar 5 17:49:51 CET 2016


Some platforms allow a QFileDialog to choose an project that doesn't exist, which causes various bugs.
---
 src/Gui/wizard/WelcomePage.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Gui/wizard/WelcomePage.cpp b/src/Gui/wizard/WelcomePage.cpp
index 096ec1d..36ed630 100644
--- a/src/Gui/wizard/WelcomePage.cpp
+++ b/src/Gui/wizard/WelcomePage.cpp
@@ -139,6 +139,13 @@ WelcomePage::loadProject()
 
     if ( projectPath.isEmpty() ) return;
 
+    if ( !QFile(projectPath).exists() )
+    {
+        QMessageBox::warning(this, tr("Invalid project file path"),
+                             tr("Please use an existing project file."));
+        return;
+    }
+
     // Search if the item is already in the list
     QListWidgetItem* item = NULL;
     for ( int i = 0; i < m_ui.projectsListWidget->count(); ++i )
-- 
1.9.1



More information about the Vlmc-devel mailing list