Fix crash when sending a message to a null address

This commit is contained in:
Benjamin Reis 2016-12-16 09:06:17 +01:00
parent ed9dc370d4
commit dc3437d1e6

View file

@ -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 {