From b9c6f3de03dea8c83037cde54cbf4b64da4632f7 Mon Sep 17 00:00:00 2001 From: Li Tan Date: Tue, 6 Jan 2015 18:04:42 -0800 Subject: [PATCH] Fix crash in Flow Controller --- AsyncDisplayKit/Details/ASFlowLayoutController.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AsyncDisplayKit/Details/ASFlowLayoutController.mm b/AsyncDisplayKit/Details/ASFlowLayoutController.mm index 27a932d68a..115b38a0e1 100644 --- a/AsyncDisplayKit/Details/ASFlowLayoutController.mm +++ b/AsyncDisplayKit/Details/ASFlowLayoutController.mm @@ -155,7 +155,7 @@ static const std::pair ASFindIndexForRange(const std::vector= 0 && cur.second >= 0) { // search backward - while (range < 0.0 && cur.second >= 0) { + while (range < 0.0 && cur.first >= 0 && cur.second >= 0) { pre = cur; CGSize size = nodes[cur.first][cur.second]; range += layoutDirection == ASFlowLayoutDirectionHorizontal ? size.width : size.height; @@ -170,7 +170,7 @@ static const std::pair ASFindIndexForRange(const std::vector 0.0 && cur.second < nodes[cur.first].size()) { + while (range > 0.0 && cur.first < nodes.size() && cur.second < nodes[cur.first].size()) { pre = cur; CGSize size = nodes[cur.first][cur.second]; range -= layoutDirection == ASFlowLayoutDirectionHorizontal ? size.width : size.height;