From 5a5fe43b4e748512774acc47d347e81413b89c78 Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Thu, 27 Dec 2018 16:01:45 -0500
Subject: [PATCH] fix crash when conversation does not exist and contact is
 added

Change-Id: I44289cc4ac77dcb3ab0445f3bdd7ef06d0d01444
---
 callwidget.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/callwidget.cpp b/callwidget.cpp
index f001bda..cfb9cdb 100644
--- a/callwidget.cpp
+++ b/callwidget.cpp
@@ -626,6 +626,9 @@ void CallWidget::slotAccountChanged(int index)
                 auto convModel = LRCInstance::getCurrentConversationModel();
                 auto currentConversation = Utils::getConversationFromUid(selectedConvUid(),
                     *convModel);
+                if (currentConversation == convModel->allFilteredConversations().end()) {
+                    return;
+                }
                 if (contactId == contactModel.get()->getContact((*currentConversation).participants.at(0)).profileInfo.uri) {
                     ui->messageView->clear();
                     ui->messageView->printHistory(*convModel, currentConversation->interactions);
-- 
GitLab