Merge pull request #840 from vector-im/fix_crash_on_recents

Bug Fix - App crashes on recents refresh
This commit is contained in:
giomfo
2016-11-29 11:57:05 +01:00
committed by GitHub
+19 -7
View File
@@ -462,32 +462,44 @@
- (id<MXKRecentCellDataStoring>)cellDataAtIndexPath:(NSIndexPath *)theIndexPath
{
id<MXKRecentCellDataStoring> cellData = nil;
NSInteger row = theIndexPath.row;
NSUInteger row = theIndexPath.row;
NSInteger section = theIndexPath.section;
if (self.droppingCellIndexPath && (self.droppingCellIndexPath.section == section))
{
if (theIndexPath.row > self.droppingCellIndexPath.row)
if (row > self.droppingCellIndexPath.row)
{
row = theIndexPath.row - 1;
row --;
}
}
if (section == favoritesSection)
{
cellData = [favoriteCellDataArray objectAtIndex:row];
if (row < favoriteCellDataArray.count)
{
cellData = [favoriteCellDataArray objectAtIndex:row];
}
}
else if (section== conversationSection)
{
cellData = [conversationCellDataArray objectAtIndex:row];
if (row < conversationCellDataArray.count)
{
cellData = [conversationCellDataArray objectAtIndex:row];
}
}
else if (section == lowPrioritySection)
{
cellData = [lowPriorityCellDataArray objectAtIndex:row];
if (row < lowPriorityCellDataArray.count)
{
cellData = [lowPriorityCellDataArray objectAtIndex:row];
}
}
else if (section == invitesSection)
{
cellData = [invitesCellDataArray objectAtIndex:row];
if (row < invitesCellDataArray.count)
{
cellData = [invitesCellDataArray objectAtIndex:row];
}
}
return cellData;