From 0d3e36dfb1030da2cf0863541300a540e365952f Mon Sep 17 00:00:00 2001
From: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
Date: Fri, 18 Oct 2024 12:50:09 -0400
Subject: [PATCH] swarms_default_host: add check for removed host

Previously when the default host device was
removed, trying to host a conference would still
attempt to connect to a device with empty Uri.

Change-Id: I8f33eba5a5b93e9d1bff2275667a885a3ebe22c5
---
 src/jamidht/conversation_module.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/jamidht/conversation_module.cpp b/src/jamidht/conversation_module.cpp
index cd7b4175a..8ac903d83 100644
--- a/src/jamidht/conversation_module.cpp
+++ b/src/jamidht/conversation_module.cpp
@@ -2991,7 +2991,7 @@ ConversationModule::call(const std::string& url,
     auto itRdvAccount = infos.find("rdvAccount");
     auto itRdvDevice = infos.find("rdvDevice");
     auto sendCallRequest = false;
-    if (confId != "") {
+    if (!confId.empty()) {
         sendCallRequest = true;
         JAMI_DEBUG("Calling self, join conference");
     } else if (!activeCalls.empty()) {
@@ -3001,7 +3001,8 @@ ConversationModule::call(const std::string& url,
         confId = ac.at("id");
         uri = ac.at("uri");
         deviceId = ac.at("device");
-    } else if (itRdvAccount != infos.end() && itRdvDevice != infos.end()) {
+    } else if (itRdvAccount != infos.end() && itRdvDevice != infos.end()
+               && !itRdvAccount->second.empty()) {
         // Else, creates "to" (accountId/deviceId/conversationId/confId) and ask remote host
         sendCallRequest = true;
         uri = itRdvAccount->second;
-- 
GitLab