Contacts: fix crash when deleting contact with swipe

This commit is contained in:
Gautier Pelloux-Prayer 2016-02-17 13:39:21 +01:00
parent 59030ec972
commit f1077154eb
2 changed files with 5 additions and 2 deletions

View file

@ -65,6 +65,9 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
_emptyLabel.hidden = YES;
} else {
_emptyLabel.hidden = NO;
if (!IPAD) {
[PhoneMainView.instance popCurrentView];
}
}
}

View file

@ -247,7 +247,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
OrderedDictionary *subDic = [addressBookMap objectForKey:[addressBookMap keyAtIndex:[indexPath section]]];
NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]];
ABRecordRef contact = (__bridge ABRecordRef)([subDic objectForKey:key]);
NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1];
NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1].uppercaseString;
[[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]];
if ([tableView numberOfRowsInSection:indexPath.section] == 1) {
[addressBookMap removeObjectForKey:firstChar];
@ -268,7 +268,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
OrderedDictionary *subDic = [addressBookMap objectForKey:[addressBookMap keyAtIndex:[indexPath section]]];
NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]];
ABRecordRef contact = (__bridge ABRecordRef)([subDic objectForKey:key]);
NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1];
NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1].uppercaseString;
[[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]];
if ([self.tableView numberOfRowsInSection:indexPath.section] == 1) {
[addressBookMap removeObjectForKey:firstChar];