From 2eae32359d8475a7e3a8c6d45ff2fa69af624d3f Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 24 Aug 2016 11:14:06 +0200 Subject: [PATCH] ContactsList: fix crash when removing contact --- Classes/ContactsListTableView.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index 01c31de6a..ade16ade5 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -246,8 +246,8 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]]; NSMutableArray *subAr = [addressBookMap objectForKey:firstChar]; Contact *contact = subAr[indexPath.row]; - [[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]]; - if ([tableView numberOfRowsInSection:indexPath.section] == 1) { + [subAr removeObjectAtIndex:indexPath.row]; + if (subAr.count == 0) { [addressBookMap removeObjectForKey:firstChar]; [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade]; @@ -271,8 +271,8 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]]; NSMutableArray *subAr = [addressBookMap objectForKey:firstChar]; Contact *contact = subAr[indexPath.row]; - [[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]]; - if ([self.tableView numberOfRowsInSection:indexPath.section] == 1) { + [subAr removeObjectAtIndex:indexPath.row]; + if (subAr.count == 0) { [addressBookMap removeObjectForKey:firstChar]; } [[LinphoneManager.instance fastAddressBook] removeContact:contact];