Contact: try to not crash when reverting address book

This commit is contained in:
Gautier Pelloux-Prayer 2016-04-05 14:49:21 +02:00
parent 9cc1a2c9f2
commit 75f66d8691

View file

@ -118,12 +118,14 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
}
- (void)selectContact:(ABRecordRef)acontact andReload:(BOOL)reload {
_contact = NULL;
[self resetData];
_emptyLabel.hidden = (acontact != NULL);
if (self.isEditing) {
[self setEditing:FALSE];
}
ABAddressBookRevert(addressBook);
_contact = acontact;
_emptyLabel.hidden = (_contact != NULL);
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:NO withRoundedRadius:YES];
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:acontact];
[_tableController setContact:[[Contact alloc] initWithPerson:_contact]];