From c6f00b1541d0db4fa8a19293feb586116e770115 Mon Sep 17 00:00:00 2001 From: Michael Schneider Date: Sun, 27 Mar 2016 17:54:40 -0700 Subject: [PATCH] Use batchCount for indexes passed into internal layout nodes method and NSMaxRange --- AsyncDisplayKit/Details/ASDataController.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AsyncDisplayKit/Details/ASDataController.mm b/AsyncDisplayKit/Details/ASDataController.mm index 64c7a18f12..e5ddc276d4 100644 --- a/AsyncDisplayKit/Details/ASDataController.mm +++ b/AsyncDisplayKit/Details/ASDataController.mm @@ -167,7 +167,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext; // For any given layout pass that occurs, this method will be called at least twice, once on the main thread and // the background, to result in complete coverage of both loaded and unloaded nodes BOOL isMainThread = ASDisplayNodeThreadIsMain(); - for (NSUInteger k = range.location; k < (range.location + range.length); k++) { + for (NSUInteger k = range.location; k < NSMaxRange(range); k++) { ASCellNode *node = nodes[k]; // Only nodes that are loaded should be layout on the main thread if (node.isNodeLoaded == isMainThread) { @@ -220,7 +220,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext; [self _layoutNodes:subarray fromContexts:contexts - inIndexesOfRange:NSMakeRange(0, subarray.count) + inIndexesOfRange:NSMakeRange(0, batchCount) ofKind:kind]; } else { @@ -228,7 +228,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext; [_mainSerialQueue performBlockOnMainThread:^{ [self _layoutNodes:subarray fromContexts:contexts - inIndexesOfRange:NSMakeRange(0, subarray.count) + inIndexesOfRange:NSMakeRange(0, batchCount) ofKind:kind]; }]; }