Commit 7a4bf9a3 authored by Fabio Bas's avatar Fabio Bas
Browse files

Fix crash on loading invalid cards.xml

Additionally, move the custom database load after the LoadStatus check,
so that they don't bring up the “fix your card database path” settings
dialog
parent 1409b974
......@@ -147,6 +147,7 @@ int main(int argc, char *argv[])
rng = new RNG_SFMT;
settingsCache = new SettingsCache;
themeManager = new ThemeManager;
soundEngine = new SoundEngine;
db = new CardDatabase;
qtTranslator = new QTranslator;
......@@ -182,13 +183,6 @@ int main(int argc, char *argv[])
}
if (!QDir().mkpath(settingsCache->getPicsPath() + "/CUSTOM"))
qDebug() << "Could not create " + settingsCache->getPicsPath().toUtf8() + "/CUSTOM. Will fall back on default card images.";
if (QDir().mkpath(dataDir + "/customsets"))
{
// if the dir exists (or has just been created)
db->loadCustomCardDatabases(dataDir + "/customsets");
} else {
qDebug() << "Could not create " + dataDir + "/customsets folder.";
}
if (!settingsValid() || db->getLoadStatus() != Ok) {
qDebug("main(): invalid settings or load status");
......@@ -197,12 +191,18 @@ int main(int argc, char *argv[])
app.exec();
}
// load custom databased after LoadStatus check, so that they don't bring up the settings dialog
if (QDir().mkpath(dataDir + "/customsets"))
{
// if the dir exists (or has just been created)
db->loadCustomCardDatabases(dataDir + "/customsets");
} else {
qDebug() << "Could not create " + dataDir + "/customsets folder.";
}
if (settingsValid()) {
qDebug("main(): starting main program");
soundEngine = new SoundEngine;
qDebug("main(): SoundEngine constructor finished");
MainWindow ui;
qDebug("main(): MainWindow constructor finished");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment