Handle nil node blocks gracefully in production (#2338)

This commit is contained in:
Adlai Holler
2016-10-03 20:06:13 -04:00
committed by GitHub
parent 0a2e35af38
commit 67045c07b8
2 changed files with 3 additions and 2 deletions

View File

@@ -1125,10 +1125,11 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
}
ASCellNodeBlock block = [_asyncDataSource tableView:self nodeBlockForRowAtIndexPath:indexPath];
ASDisplayNodeAssertNotNil(block, @"Invalid block, expected nonnull ASCellNodeBlock");
__weak __typeof__(self) weakSelf = self;
ASCellNodeBlock configuredNodeBlock = ^{
__typeof__(self) strongSelf = weakSelf;
ASCellNode *node = block();
ASCellNode *node = (block != nil ? block() : [[ASCellNode alloc] init]);
[node enterHierarchyState:ASHierarchyStateRangeManaged];
if (node.interactionDelegate == nil) {
node.interactionDelegate = strongSelf;