From 4eb36a243fc07b30f37318a8dfa74ef74a24b43b Mon Sep 17 00:00:00 2001
From: Nicolas Jager <nicolas.jager@savoirfairelinux.com>
Date: Tue, 31 Oct 2017 09:42:35 -0400
Subject: [PATCH] fix : crash when sending message outside a call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- bug : sending a message outside a call lead to throw a
  std::out_of_range.

- fix : correct the condition by replacing a 'or' by 'and'

Change-Id: Ieab9a3b3a1e6c411545c13d865b6e83faa727c3a
Reviewed-by: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
---
 src/conversationmodel.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp
index 8324651b..18b17d97 100644
--- a/src/conversationmodel.cpp
+++ b/src/conversationmodel.cpp
@@ -458,8 +458,8 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body)
             conversation.callId.clear();
 
         if (not conversation.callId.empty()
-            or owner.callModel->getCall(conversation.callId).status != call::Status::IN_PROGRESS
-            or owner.callModel->getCall(conversation.callId).status != call::Status::PAUSED) {
+            and (owner.callModel->getCall(conversation.callId).status != call::Status::IN_PROGRESS
+                 or owner.callModel->getCall(conversation.callId).status != call::Status::PAUSED)) {
 
             owner.callModel->sendSipMessage(conversation.callId, body);
 
-- 
GitLab