From e31baf3ee6681373867e9a50f02cdbbad6027291 Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 17 Jun 2015 18:33:16 +0200 Subject: - bugfix: MO crashed without error message when "bootstrapping" failed --- src/main.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 549de4a9..295fb75a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -369,23 +369,29 @@ int main(int argc, char *argv[]) return 1; } - if (!bootstrap()) { // requires gameinfo to be initialised! - return -1; - } + QPixmap pixmap(":/MO/gui/splash"); + QSplashScreen splash(pixmap); + + try { + if (!bootstrap()) { // requires gameinfo to be initialised! + return -1; + } - LogBuffer::init(100, QtDebugMsg, qApp->property("dataPath").toString() + "/logs/mo_interface.log"); + LogBuffer::init(100, QtDebugMsg, qApp->property("dataPath").toString() + "/logs/mo_interface.log"); #if QT_VERSION >= 0x050000 - qDebug("ssl support: %d", QSslSocket::supportsSsl()); + qDebug("ssl support: %d", QSslSocket::supportsSsl()); #endif - qDebug("Working directory: %s", qPrintable(QDir::toNativeSeparators(QDir::currentPath()))); - qDebug("MO at: %s", qPrintable(QDir::toNativeSeparators(application.applicationDirPath()))); - QPixmap pixmap(":/MO/gui/splash"); - QSplashScreen splash(pixmap); - splash.show(); + qDebug("Working directory: %s", qPrintable(QDir::toNativeSeparators(QDir::currentPath()))); + qDebug("MO at: %s", qPrintable(QDir::toNativeSeparators(application.applicationDirPath()))); + splash.show(); - cleanupDir(); + cleanupDir(); + } catch (const std::exception &e) { + reportError(e.what()); + return 1; + } { // extend path to include dll directory so plugins don't need a manifest // (using AddDllDirectory would be an alternative to this but it seems fairly complicated esp. -- cgit v1.3.1