From: xue <2144439972@qq.com> Date: Sat, 10 Jan 2026 09:58:08 +0000 (+0800) Subject: 增加退出对话空指针检测 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3062%2F2;p=mirrors%2FFD230.git 增加退出对话空指针检测 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp index 398683999..5e56e184a 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp @@ -242,13 +242,13 @@ namespace OHOS // } // 检查是否从对话/哄睡退出,如果是则获取时间线表情 - if (ThunderBirdModel::GetInstance()->m_needGetTimelineExpression) { + if (ThunderBirdModel::GetInstance() && ThunderBirdModel::GetInstance()->m_needGetTimelineExpression) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdDialogueView::Show: 从对话/哄睡退出到发呆中界面,获取时间线表情"); // 获取时间线表情 do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_TIMELINE_GET_STATUS, NULL, 0); // 重置标志位 ThunderBirdModel::GetInstance()->m_needGetTimelineExpression = false; - } else { + } else if (ThunderBirdModel::GetInstance()) { // 正常进入发呆中界面,设置标志位为1 ThunderBirdModel::GetInstance()->m_needGetTimelineExpression = true; } @@ -300,17 +300,19 @@ namespace OHOS { if(!flag) { - speakAnimator->SetVisible(true); + if (speakAnimator) { speakAnimator->SetVisible(true); } // speakAnimator->Stop(); - RemindButton->SetVisible(true); - micIcon->SetVisible(true); + if (RemindButton) { RemindButton->SetVisible(true); } + if (micIcon) { micIcon->SetVisible(true); } } else { - speakAnimator->SetVisible(false); - speakAnimator->Stop(); - RemindButton->SetVisible(false); - micIcon->SetVisible(false); + if (speakAnimator) { + speakAnimator->SetVisible(false); + speakAnimator->Stop(); + } + if (RemindButton) { RemindButton->SetVisible(false); } + if (micIcon) { micIcon->SetVisible(false); } } }