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
This commit is contained in:
Olivier Goffart 2014-05-26 11:08:32 +02:00
parent 3f724e1c6a
commit f9263da3de

View file

@ -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();