From d4e19e11aa7f16ccd32cbca2c755f77ea1824cdb Mon Sep 17 00:00:00 2001 From: ma-shaoyin Date: Fri, 18 Oct 2024 10:05:32 +0800 Subject: [PATCH] Signed-off-by: ma-shaoyin Changes to be committed: --- .../inputmethod_ability/src/input_method_ability.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frameworks/native/inputmethod_ability/src/input_method_ability.cpp b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp index e19bcc12..f6b08532 100644 --- a/frameworks/native/inputmethod_ability/src/input_method_ability.cpp +++ b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp @@ -858,15 +858,14 @@ int32_t InputMethodAbility::ShowPanel(const std::shared_ptr &i int32_t InputMethodAbility::HidePanel(const std::shared_ptr &inputMethodPanel) { // Current Ime is exiting, hide softkeyboard will cause the TextFiled to lose focus. - if (isImeTerminating.load() && inputMethodPanel != nullptr && - inputMethodPanel->GetPanelType() == PanelType::SOFT_KEYBOARD) { + if (inputMethodPanel == nullptr) { + return ErrorCode::ERROR_BAD_PARAMETERS; + } + if (isImeTerminating.load() && inputMethodPanel->GetPanelType() == PanelType::SOFT_KEYBOARD) { IMSA_HILOGI("Current Ime is terminating, no need to hide keyboard."); return ErrorCode::NO_ERROR; } std::lock_guard lock(keyboardCmdLock_); - if (inputMethodPanel == nullptr) { - return ErrorCode::ERROR_BAD_PARAMETERS; - } return HidePanel(inputMethodPanel, inputMethodPanel->GetPanelFlag(), Trigger::IME_APP, false); }