From d81a8b074317d9cee3a28a8e9d9fc07a9a85f6b8 Mon Sep 17 00:00:00 2001 From: PipixiaSummer Date: Thu, 7 Aug 2025 16:53:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9cj=E4=BE=A7=E5=87=BD=E6=95=B0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E8=BF=9B=E8=A1=8C=E5=88=A4=E7=A9=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: PipixiaSummer --- frameworks/cj/src/cj_input_method_controller.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frameworks/cj/src/cj_input_method_controller.cpp b/frameworks/cj/src/cj_input_method_controller.cpp index 8b7c638a2..3953e4387 100644 --- a/frameworks/cj/src/cj_input_method_controller.cpp +++ b/frameworks/cj/src/cj_input_method_controller.cpp @@ -409,6 +409,10 @@ std::u16string CjInputMethodController::GetLeftText(int32_t number) } IMSA_HILOGD("getLeftText runs"); char *text = getLeftText(number); + if (text == nullptr) { + IMSA_HILOGD("text is nullptr"); + return u""; + } auto ret = Str8ToStr16(std::string(text)); free(text); return ret; @@ -422,6 +426,10 @@ std::u16string CjInputMethodController::GetRightText(int32_t number) } IMSA_HILOGD("getRightText runs"); char *text = getRightText(number); + if (text == nullptr) { + IMSA_HILOGD("text is nullptr"); + return u""; + } auto ret = Str8ToStr16(std::string(text)); free(text); return ret; -- Gitee