From 3aa6fc0d3899048252884db7f0144f6be6501513 Mon Sep 17 00:00:00 2001 From: Andrew Toulouse Date: Mon, 22 Sep 2014 21:10:51 -0700 Subject: [PATCH] Mehod -numberOfSectionsInTableView: is optional but not conditionally checked The documentation for `UITableViewDataSource` specifies that the default value is 1, and that its implementation is optional. However, ASTableView's forwarding doesn't account for the unimplemented case. The desired behavior is to return 1 in the case that the method is not implemented. --- AsyncDisplayKit/ASTableView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AsyncDisplayKit/ASTableView.m b/AsyncDisplayKit/ASTableView.m index c18a0dd295..eb17dc58d3 100644 --- a/AsyncDisplayKit/ASTableView.m +++ b/AsyncDisplayKit/ASTableView.m @@ -317,7 +317,11 @@ static BOOL _isInterceptedSelector(SEL sel) - (NSInteger)rangeControllerSections:(ASRangeController *)rangeController { ASDisplayNodeAssertMainThread(); - return [_asyncDataSource numberOfSectionsInTableView:self]; + if ([_asyncDataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]) { + return [_asyncDataSource numberOfSectionsInTableView:self]; + } else { + return 1; + } } - (NSInteger)rangeController:(ASRangeController *)rangeController rowsInSection:(NSInteger)section