mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Fix crash in Flow Controller
This commit is contained in:
@@ -155,7 +155,7 @@ static const std::pair<int, int> ASFindIndexForRange(const std::vector<std::vect
|
|||||||
|
|
||||||
if (range < 0.0 && cur.first >= 0 && cur.second >= 0) {
|
if (range < 0.0 && cur.first >= 0 && cur.second >= 0) {
|
||||||
// search backward
|
// search backward
|
||||||
while (range < 0.0 && cur.second >= 0) {
|
while (range < 0.0 && cur.first >= 0 && cur.second >= 0) {
|
||||||
pre = cur;
|
pre = cur;
|
||||||
CGSize size = nodes[cur.first][cur.second];
|
CGSize size = nodes[cur.first][cur.second];
|
||||||
range += layoutDirection == ASFlowLayoutDirectionHorizontal ? size.width : size.height;
|
range += layoutDirection == ASFlowLayoutDirectionHorizontal ? size.width : size.height;
|
||||||
@@ -170,7 +170,7 @@ static const std::pair<int, int> ASFindIndexForRange(const std::vector<std::vect
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// search forward
|
// search forward
|
||||||
while (range > 0.0 && cur.second < nodes[cur.first].size()) {
|
while (range > 0.0 && cur.first < nodes.size() && cur.second < nodes[cur.first].size()) {
|
||||||
pre = cur;
|
pre = cur;
|
||||||
CGSize size = nodes[cur.first][cur.second];
|
CGSize size = nodes[cur.first][cur.second];
|
||||||
range -= layoutDirection == ASFlowLayoutDirectionHorizontal ? size.width : size.height;
|
range -= layoutDirection == ASFlowLayoutDirectionHorizontal ? size.width : size.height;
|
||||||
|
|||||||
Reference in New Issue
Block a user