diff --git a/src/database.cpp b/src/database.cpp index 13a5026f6e2e808c16e42fe011fe5674c6ac82ec..db0b827b74cbcb82e30c721e89621ab20c24eea0 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -605,6 +605,14 @@ LegacyDatabase::migrateLocalProfiles() const QStringList accountIds = ConfigurationManager::instance().getAccountList(); for (auto accountId : accountIds) { + // NOTE: If the daemon is down, but dbus answered, id can contains + // "Remote peer disconnected", "The name is not activable", etc. + // So avoid to migrate useless directories. + for (auto& id : accountIds) + if (id.indexOf(" ") != -1) { + qWarning() << "Invalid dbus answer. Daemon not running"; + return; + } MapStringString account = ConfigurationManager::instance(). getAccountDetails(accountId.toStdString().c_str()); auto accountURI = account[DRing::Account::ConfProperties::USERNAME].contains("ring:") ? @@ -847,9 +855,16 @@ LegacyDatabase::migrateSchemaFromVersion1() void LegacyDatabase::linkRingProfilesWithAccounts(bool contactsOnly) { - const QStringList accountIds = - ConfigurationManager::instance().getAccountList(); + const QStringList accountIds = ConfigurationManager::instance().getAccountList(); for (auto accountId : accountIds) { + // NOTE: If the daemon is down, but dbus answered, id can contains + // "Remote peer disconnected", "The name is not activable", etc. + // So avoid to migrate useless directories. + for (auto& id : accountIds) + if (id.indexOf(" ") != -1) { + qWarning() << "Invalid dbus answer. Daemon not running"; + return; + } MapStringString account = ConfigurationManager::instance(). getAccountDetails(accountId.toStdString().c_str()); auto accountURI = account[DRing::Account::ConfProperties::USERNAME].contains("ring:") ? diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp index f24c162d004213687a9f029662776c8fb67798b3..dd60a51c7359ee8d677b0b4e9a3e636166295e5d 100644 --- a/src/newaccountmodel.cpp +++ b/src/newaccountmodel.cpp @@ -339,6 +339,16 @@ NewAccountModelPimpl::NewAccountModelPimpl(NewAccountModel& linked, , username_changed(false) { const QStringList accountIds = ConfigurationManager::instance().getAccountList(); + + // NOTE: If the daemon is down, but dbus answered, id can contains + // "Remote peer disconnected", "The name is not activable", etc. + // So avoid to migrate useless directories. + for (auto& id : accountIds) + if (id.indexOf(" ") != -1) { + qWarning() << "Invalid dbus answer. Daemon not running"; + return; + } + auto accountDbs = authority::storage::migrateIfNeeded(accountIds, willMigrateCb, didMigrateCb); for (const auto& id : accountIds) { addToAccounts(id.toStdString(), accountDbs.at(accountIds.indexOf(id)));