From f9263da3dedc8093d7655b16ab863c2f4f9fd378 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 26 May 2014 11:08:32 +0200 Subject: [PATCH] Fix crash when the account config is gone and there are still folder In rare case (due to a bug in QSettings) the account config may disapear We should not crash in that case --- src/mirall/folder.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp index 91bbbf8e6..6ba5abfa8 100644 --- a/src/mirall/folder.cpp +++ b/src/mirall/folder.cpp @@ -91,6 +91,14 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP bool Folder::init() { + Account *account = AccountManager::instance()->account(); + if (!account) { + // Normaly this should not happen, but it could be that there is something + // wrong with the config and it is better not to crash. + qWarning() << "WRN: No account configured, can't sync"; + return false; + } + QString url = Utility::toCSyncScheme(remoteUrl().toString()); QString localpath = path();