From 3a8a97919ed2331afeab061081ada2be552d7224 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 22 Feb 2016 16:27:41 +0100 Subject: [PATCH] Chat: fix crash when sending chat message to non-lime user --- Classes/ChatConversationView.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index d5a595a61..f13002729 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -226,8 +226,11 @@ static UICompositeViewDescription *compositeDescription = nil; [LinphoneManager setValueInMessageAppData:[internalUrl absoluteString] forKey:@"localimage" inMessage:msg]; } - linphone_chat_room_send_chat_message(_chatRoom, msg); + // we must ref & unref message because in case of error, it will be destroy otherwise + linphone_chat_room_send_chat_message(_chatRoom, linphone_chat_message_ref(msg)); [_tableController addChatEntry:msg]; + linphone_chat_message_unref(msg); + [_tableController scrollToBottom:true]; return TRUE;