From 1da2bde81323c18eae642afbbcfdb1ad907ad7c0 Mon Sep 17 00:00:00 2001 From: lampman Date: Sun, 5 Nov 2023 22:27:32 +0800 Subject: [PATCH] fix crash when apple pencil touch the screen --- Sources/SwiftTerm/iOS/iOSTextInput.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftTerm/iOS/iOSTextInput.swift b/Sources/SwiftTerm/iOS/iOSTextInput.swift index 9d632427..e4173ebd 100644 --- a/Sources/SwiftTerm/iOS/iOSTextInput.swift +++ b/Sources/SwiftTerm/iOS/iOSTextInput.swift @@ -60,7 +60,7 @@ extension TerminalView: UITextInput { } public func text(in range: UITextRange) -> String? { - let r = range as! xTextRange + guard let r = range as? xTextRange else { return "" } if textInputStorage.count >= max (r._start, r._end) { let res = String (textInputStorage [r._start..