diff --git a/src/jamidht/archive_account_manager.cpp b/src/jamidht/archive_account_manager.cpp index 19f77647d4f644878c837085a9f8fba8ef04a326..90b7c06a4d9c050313d0ecb6f86fabf457333f51 100644 --- a/src/jamidht/archive_account_manager.cpp +++ b/src/jamidht/archive_account_manager.cpp @@ -617,7 +617,7 @@ ArchiveAccountManager::addDevice(const std::string& password, AddDeviceCallback try { this_.updateArchive(a); auto encrypted = dht::crypto::aesEncrypt(archiver::compress(a.serialize()), key); - if (not this_.dht_->isRunning()) + if (not this_.dht_ or not this_.dht_->isRunning()) throw std::runtime_error("DHT is not running.."); JAMI_WARN("[Auth] exporting account with PIN: %s at %s (size %zu)", pin_str.c_str(), diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 8d15d33cfa6daa8625e208aeae0de9144cf2da97..9313f6220aafc1e6d7c570c612b2a9a52b9e74d7 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -979,12 +979,16 @@ JamiAccount::changeArchivePassword(const std::string& password_old, const std::s bool JamiAccount::isPasswordValid(const std::string& password) { - return accountManager_->isPasswordValid(password); + return accountManager_ and accountManager_->isPasswordValid(password); } void JamiAccount::addDevice(const std::string& password) { + if (not accountManager_) { + emitSignal<DRing::ConfigurationSignal::ExportOnRingEnded>(getAccountID(), 2, ""); + return; + } accountManager_ ->addDevice(password, [this](AccountManager::AddDeviceResult result, std::string pin) { switch (result) { @@ -3491,7 +3495,7 @@ JamiAccount::requestSIPConnection(const std::string& peerId, const std::string& { // If a connection already exists or is in progress, no need to do this std::lock_guard<std::mutex> lk(sipConnectionsMtx_); - auto id = std::make_pair<std::string, std::string>(std::string(peerId), std::string(deviceId)); + const auto& id = std::make_pair(peerId, deviceId); if (!sipConnections_[peerId][deviceId].empty() || pendingSipConnections_.find(id) != pendingSipConnections_.end()) { JAMI_DBG("A SIP connection with %s already exists", deviceId.c_str());