From dc3437d1e6dfca214dd4c23e5810817fa0023f2c Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 16 Dec 2016 09:06:17 +0100 Subject: [PATCH] Fix crash when sending a message to a null address --- Classes/LinphoneUI/UIChatBubbleTextCell.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 810b547a3..e36672f4c 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -83,10 +83,13 @@ } + (NSString *)ContactDateForChat:(LinphoneChatMessage *)message { - return [NSString - stringWithFormat:@"%@ - %@", [LinphoneUtils timeToString:linphone_chat_message_get_time(message) - withFormat:LinphoneDateChatBubble], - [FastAddressBook displayNameForAddress:linphone_chat_message_get_from_address(message)]]; + const LinphoneAddress *address = + linphone_chat_message_get_from_address(message) + ? linphone_chat_message_get_from_address(message) + : linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(message)); + return [NSString stringWithFormat:@"%@ - %@", [LinphoneUtils timeToString:linphone_chat_message_get_time(message) + withFormat:LinphoneDateChatBubble], + [FastAddressBook displayNameForAddress:address]]; } - (NSString *)textMessage {