Check if broken line range is out of string length

This commit is contained in:
Ilya Laktyushin 2021-12-19 18:34:04 +04:00
parent 5ddfb0dd63
commit 6cdf72427c

View File

@ -1034,6 +1034,9 @@ public class TextNode: ASDisplayNode {
coreTextLine = CTLineCreateTruncatedLine(originalLine, Double(lineConstrainedSize.width), truncationType, truncationToken) ?? truncationToken
brokenLineRange.length = CTLineGetGlyphCount(coreTextLine) - 1
if brokenLineRange.location + brokenLineRange.length > attributedString.length {
brokenLineRange.length = attributedString.length - brokenLineRange.location
}
truncated = true
}