Avoid accessing itemCountsFromDataSource off-main (#2106)

This commit is contained in:
Adlai Holler
2016-08-19 12:10:19 -07:00
committed by GitHub
parent fa3a988b54
commit 69e73065e5

View File

@@ -65,7 +65,10 @@
[self deleteSectionsOfKind:kind atIndexSet:indexSet completion:nil];
// Insert each section
NSUInteger sectionCount = self.itemCountsFromDataSource.size();
NSUInteger sectionCount = 0;
for (ASIndexedNodeContext *context in contexts) {
sectionCount = MAX(sectionCount, context.indexPath.section + 1);
}
NSMutableArray *sections = [NSMutableArray arrayWithCapacity:sectionCount];
for (int i = 0; i < sectionCount; i++) {
[sections addObject:[NSMutableArray array]];