From 2edb6f9b4d70b85b9209d75d1baa7a16e3b8d279 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 8 Sep 2012 09:55:39 +0200 Subject: Don't crash when settings are not available SheMov crashed with a SEGV when QSettings could not be read. Show ConfigurationDialog and exit program instead. I wonder if this is just pasting over another bug, though. --- smglobals.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smglobals.cpp b/smglobals.cpp index 58ecf84..b73c89b 100644 --- a/smglobals.cpp +++ b/smglobals.cpp @@ -28,6 +28,7 @@ #include "seriesmetadatamodel.h" #include "mappingtreemodel.h" #include "pictureviewer2.h" +#include "configurationdialog.h" SmGlobals *SmGlobals::mInstance = 0; @@ -49,7 +50,11 @@ SmGlobals *SmGlobals::instance(){ db.setPassword(s.value("database/dbpass").toString()); db.setDatabaseName(s.value("database/dbname").toString()); if(!db.open()){ - QMessageBox::critical(0, tr("Error"), tr("Could not open database. Please configure it and restart program.")); + QMessageBox::critical(0, tr("Error"), tr("Could not open database.")); + ConfigurationDialog configDlg; + configDlg.exec(); + QMessageBox::information(0, tr("Notice"), tr("I will exit now. Start me again!")); + exit(EXIT_SUCCESS); } } } -- cgit v1.2.3-70-g09d2