mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Allow section-indexpaths in collection & table validation (#2727)
This commit is contained in:
@@ -642,7 +642,9 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (indexPath.item >= [self numberOfItemsInSection:section]) {
|
||||
NSInteger item = indexPath.item;
|
||||
// item == NSNotFound means e.g. "scroll to this section" and is acceptable
|
||||
if (item != NSNotFound && item >= [self numberOfItemsInSection:section]) {
|
||||
ASDisplayNodeFailAssert(@"Collection view index path has invalid item %lu in section %lu, item count = %lu", (unsigned long)indexPath.item, (unsigned long)section, (unsigned long)[self numberOfItemsInSection:section]);
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -579,7 +579,9 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (indexPath.item >= [self numberOfRowsInSection:section]) {
|
||||
NSInteger item = indexPath.item;
|
||||
// item == NSNotFound means e.g. "scroll to this section" and is acceptable
|
||||
if (item != NSNotFound && item >= [self numberOfRowsInSection:section]) {
|
||||
ASDisplayNodeFailAssert(@"Table view index path has invalid item %lu in section %lu, item count = %lu", (unsigned long)indexPath.item, (unsigned long)section, (unsigned long)[self numberOfRowsInSection:section]);
|
||||
return nil;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user