From e574f00415b548912579daf4eaa12ce43ca61c74 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Mon, 7 Feb 2022 11:05:04 +0100 Subject: [PATCH] Fix crash in basic chatrooms --- Classes/ChatConversationView.m | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index c1b125408..8c33a4e4a 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -528,22 +528,18 @@ static UICompositeViewDescription *compositeDescription = nil; } LinphoneChatMessage *msg = rootMessage; - BOOL basic = [ChatConversationView isBasicChatRoom:_chatRoom]; - if (message && message.length > 0) { - if (!basic) - linphone_chat_message_add_utf8_text_content(msg, message.UTF8String); - } - if (externalUrl) { linphone_chat_message_set_external_body_url(msg, [[externalUrl absoluteString] UTF8String]); } - // we must ref & unref message because in case of error, it will be destroy otherwise - linphone_chat_message_send(msg); - if (basic && message && message.length > 0) { - linphone_chat_message_send(linphone_chat_room_create_message_from_utf8(_chatRoom, message.UTF8String)); + if (message && message.length > 0) { + if ([ChatConversationView isBasicChatRoom:_chatRoom]) + linphone_chat_message_send(linphone_chat_room_create_message_from_utf8(_chatRoom, message.UTF8String)); + else { + linphone_chat_message_add_utf8_text_content(msg, message.UTF8String); + linphone_chat_message_send(msg); + } } - return TRUE; }