From 75f66d869160ccac8cfdd5ad56471fce68460b8e Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 5 Apr 2016 14:49:21 +0200 Subject: [PATCH] Contact: try to not crash when reverting address book --- Classes/ContactDetailsView.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index f0d857aab..8c5daf4ce 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -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]];