We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f862d6 commit 8ab46b2Copy full SHA for 8ab46b2
Proton/Sources/Swift/Core/RichTextView.swift
@@ -829,7 +829,11 @@ class RichTextView: AutogrowingTextView {
829
}
830
831
override func caretRect(for position: UITextPosition) -> CGRect {
832
- guard isEditable else {
+ // layoutManager.numberOfGlyphs check is required to prevent cases where selectedRange is accessed
833
+ // while TextProcessor is processing and contents are changed to prevent a crash that may result when
834
+ // this is not same as textStorage.length
835
+ guard isEditable,
836
+ layoutManager.numberOfGlyphs == textStorage.length else {
837
return super.caretRect(for: position)
838
839
0 commit comments