Fix crashes

This commit is contained in:
Ali
2021-07-16 20:50:27 +02:00
parent 9941c499c6
commit 97cf00c506
2 changed files with 21 additions and 3 deletions

View File

@@ -1025,7 +1025,14 @@ public class TextNode: ASDisplayNode {
layoutSize.height += fontLineSpacing
}
let lineRange = CFRangeMake(lastLineCharacterIndex, lineCharacterCount)
var lineRange = CFRangeMake(lastLineCharacterIndex, lineCharacterCount)
if lineRange.location + lineRange.length > attributedString.length {
lineRange.length = attributedString.length - lineRange.location
}
if lineRange.length < 0 {
break
}
let coreTextLine = CTTypesetterCreateLineWithOffset(typesetter, lineRange, 100.0)
lastLineCharacterIndex += lineCharacterCount