From 3d97dd97599871f0eaa2bc88858c452a30de85ae Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Fri, 12 Aug 2022 10:39:40 +0800 Subject: [PATCH] ctlIME // Stop clearInlineDisplay() from being crashed by nil. --- .../ControllerModules/ctlInputMethod_HandleStates.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_HandleStates.swift b/Source/Modules/ControllerModules/ctlInputMethod_HandleStates.swift index c4fd77ec..16f1028e 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_HandleStates.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_HandleStates.swift @@ -103,7 +103,8 @@ extension ctlInputMethod { /// 在處理不受 .NotEmpty() 管轄的狀態時可能要用到的函式,會清空螢幕上顯示的內文組字區。 /// 當 setInlineDisplayWithCursor() 在錯誤的狀態下被呼叫時,也會觸發這個函式。 private func clearInlineDisplay() { - client().setMarkedText( + guard let theClient = client() else { return } + theClient.setMarkedText( "", selectionRange: NSRange(location: 0, length: 0), replacementRange: NSRange(location: NSNotFound, length: NSNotFound) )