From 922a0d03459317ebb78c42d814758888e7c58aee Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 21 Jul 2022 17:32:40 +0800 Subject: [PATCH] ctlIME // Attempt to fix crash when calling activateServer(). --- Source/Modules/ControllerModules/ctlInputMethod_Core.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index 017a4320..f4d9bf13 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -96,6 +96,10 @@ class ctlInputMethod: IMKInputController { _ = sender // 防止格式整理工具毀掉與此對應的參數。 UserDefaults.standard.synchronize() + // 因為偶爾會收到與 activateServer 有關的以「強制拆 nil」為理由的報錯, + // 所以這裡添加這句、來試圖應對這種情況。 + if keyHandler.delegate == nil { keyHandler.delegate = self } + keyHandler.clear() keyHandler.ensureParser()