summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-09-08 09:55:39 +0200
committerArno <am@disconnect.de>2012-09-08 09:55:39 +0200
commit2edb6f9b4d70b85b9209d75d1baa7a16e3b8d279 (patch)
tree8f62a0dfbf5266be064ca7513d6176a4daf485c1
parente36afa2180ef93a1bbf0398b29be3d8c62ab90cc (diff)
downloadSheMov-2edb6f9b4d70b85b9209d75d1baa7a16e3b8d279.tar.gz
SheMov-2edb6f9b4d70b85b9209d75d1baa7a16e3b8d279.tar.bz2
SheMov-2edb6f9b4d70b85b9209d75d1baa7a16e3b8d279.zip
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.
-rw-r--r--smglobals.cpp7
1 files changed, 6 insertions, 1 deletions
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);
}
}
}