Fix issue #28.

This commit is contained in:
Nadine Salter 2014-09-24 14:23:42 -07:00
parent f77f63878d
commit b8afd06b37

View File

@ -585,8 +585,9 @@ static BOOL ASIndexPathsAreSequential(NSIndexPath *first, NSIndexPath *second)
{ {
// sanity-check input // sanity-check input
// TODO this is proof-of-concept-quality, expand validation when fleshing out update / editing support // TODO this is proof-of-concept-quality, expand validation when fleshing out update / editing support
BOOL indexPathsAreValid = ASIndexPathsAreSequential([self indexPathForIndex:_totalNodeCount - 1], NSIndexPath *lastNode = (_totalNodeCount > 0) ? [self indexPathForIndex:_totalNodeCount - 1] : nil;
[indexPaths firstObject]); BOOL indexPathsAreValid = ((lastNode && ASIndexPathsAreSequential(lastNode, [indexPaths firstObject])) ||
[[indexPaths firstObject] isEqual:[NSIndexPath indexPathForRow:0 inSection:0]]);
if (!indexPaths || !indexPaths.count || !indexPathsAreValid) { if (!indexPaths || !indexPaths.count || !indexPathsAreValid) {
ASDisplayNodeAssert(NO, @"invalid argument"); ASDisplayNodeAssert(NO, @"invalid argument");
return; return;