diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 136b442f8..35f5a884a 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -86,7 +86,8 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo ms_list_free(history); } linphone_chat_room_set_user_data(chat_room, last_msg); - sorted = ms_list_insert_sorted(sorted, chat_room, (MSCompareFunc)sorted_history_comparison); + sorted = + ms_list_insert_sorted(sorted, linphone_chat_room_ref(chat_room), (MSCompareFunc)sorted_history_comparison); iter = iter->next; } return sorted; @@ -98,6 +99,7 @@ static void chatTable_free_chatrooms(void *data) { linphone_chat_message_unref(lastMsg); linphone_chat_room_set_user_data(data, NULL); } + linphone_chat_room_unref(data); } - (void)loadData { diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index 8ee1fd7be..ebf463cbd 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -156,10 +156,12 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onContactClick:(id)event { LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); ABRecordRef contact = [FastAddressBook getContactWithAddress:addr]; - ContactDetailsView *view = VIEW(ContactDetailsView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; - [ContactSelection setSelectionMode:ContactSelectionModeNone]; - [view setContact:contact]; + if (contact) { + ContactDetailsView *view = VIEW(ContactDetailsView); + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE]; + [ContactSelection setSelectionMode:ContactSelectionModeNone]; + [view setContact:contact]; + } } - (IBAction)onAddContactClick:(id)event {