From 52b17abb2d973f3d141fbb9e2be1678232f47bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 12 Aug 2021 11:38:35 -0400 Subject: [PATCH] jamiaccount: avoid to crash if conversation is not created For whatever reason, generating a git repository can fail and throw an exception. This should be catched. Change-Id: Ic4dc73d7f83132fba022e83726c1c2ecd05453ed GitLab: https://git.jami.net/savoirfairelinux/ring-project/-/issues/1282 --- src/jamidht/jamiaccount.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 83dc2b9fae..3c7fc245f2 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -3699,7 +3699,15 @@ std::string JamiAccount::startConversation(ConversationMode mode, const std::string& otherMember) { // Create the conversation object - auto conversation = std::make_shared<Conversation>(weak(), mode, otherMember); + std::shared_ptr<Conversation> conversation; + try { + conversation = std::make_shared<Conversation>(weak(), mode, otherMember); + } catch (const std::exception& e) { + JAMI_ERR("[Account %s] Error while generating a conversation %s", + getAccountID().c_str(), + e.what()); + return {}; + } auto convId = conversation->id(); { std::lock_guard<std::mutex> lk(conversationsMtx_); -- GitLab