mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 20:00:38 +00:00
Check if broken line range is out of string length
This commit is contained in:
parent
5ddfb0dd63
commit
6cdf72427c
@ -1034,6 +1034,9 @@ public class TextNode: ASDisplayNode {
|
|||||||
|
|
||||||
coreTextLine = CTLineCreateTruncatedLine(originalLine, Double(lineConstrainedSize.width), truncationType, truncationToken) ?? truncationToken
|
coreTextLine = CTLineCreateTruncatedLine(originalLine, Double(lineConstrainedSize.width), truncationType, truncationToken) ?? truncationToken
|
||||||
brokenLineRange.length = CTLineGetGlyphCount(coreTextLine) - 1
|
brokenLineRange.length = CTLineGetGlyphCount(coreTextLine) - 1
|
||||||
|
if brokenLineRange.location + brokenLineRange.length > attributedString.length {
|
||||||
|
brokenLineRange.length = attributedString.length - brokenLineRange.location
|
||||||
|
}
|
||||||
truncated = true
|
truncated = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user