mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-24 01:38:26 +00:00
Avoid warning at [IGListAdapter visibleObjects]
Summary: Almost all of the [warnings](https://fburl.com/scuba/errorreporting_instagram_ios_assertions/s2odhkpd) at `[IGListAdapter visibleObjects]` shown the section index is `9223372036854775807`, which is `NSNotFound`. When the section is `NSNotFound`, there is no need to get object though `[self objectAtSection:section];`, instead we should skip all the operations. Differential Revision: D39294533 fbshipit-source-id: 3e481c76c0a2dd53b219800e590395b067ae2db8
This commit is contained in:
parent
2414d3cca5
commit
cf7f78e28a
1 changed files with 6 additions and 4 deletions
|
|
@ -603,10 +603,12 @@ typedef struct OffsetRange {
|
|||
IGAssert(sectionController != nil, @"Section controller nil for cell %@", cell);
|
||||
if (sectionController != nil) {
|
||||
const NSInteger section = [self sectionForSectionController:sectionController];
|
||||
id object = [self objectAtSection:section];
|
||||
IGAssert(object != nil, @"Object not found for section controller %@ at section %li", sectionController, (long)section);
|
||||
if (object != nil) {
|
||||
[visibleObjects addObject:object];
|
||||
if (section != NSNotFound) {
|
||||
id object = [self objectAtSection:section];
|
||||
IGAssert(object != nil, @"Object not found for section controller %@ at section %li", sectionController, (long)section);
|
||||
if (object != nil) {
|
||||
[visibleObjects addObject:object];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue