iPad Crashes when you select a contact in search and then collapse a section or clear the query text (#4414).

This commit is contained in:
langleyd
2021-06-09 17:53:05 +01:00
parent 3eaaee9ca7
commit e8db7e9189
2 changed files with 7 additions and 3 deletions
@@ -688,12 +688,16 @@
NSUInteger index = [filteredLocalContacts indexOfObject:contact];
if (index != NSNotFound)
{
indexPath = [NSIndexPath indexPathForRow:index inSection:filteredLocalContactsSection];
// if local section is collapsed there is no cell
if (!(shrinkedSectionsBitMask & CONTACTSDATASOURCE_LOCALCONTACTS_BITWISE)) {
indexPath = [NSIndexPath indexPathForRow:index inSection:filteredLocalContactsSection];
}
}
else
{
index = [filteredMatrixContacts indexOfObject:contact];
if (index != NSNotFound)
// if matrix section is collapsed or we are not showing the matrix section(as with empty query) there is no cell
if (index != NSNotFound && !(shrinkedSectionsBitMask & CONTACTSDATASOURCE_USERDIRECTORY_BITWISE) && filteredMatrixContactsSection != -1)
{
indexPath = [NSIndexPath indexPathForRow:index inSection:filteredMatrixContactsSection];
}