From 3f1e05b255867b8d9d31212fe840bcfa8f23b50c Mon Sep 17 00:00:00 2001 From: Alfred Lieu <98323252+AlfredLouis00@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:19:51 +0800 Subject: [PATCH] fix: fix unexpected crash in some applications (#1458) --- WeaselTSF/CandidateList.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/WeaselTSF/CandidateList.cpp b/WeaselTSF/CandidateList.cpp index 66c40be82..cdf2c3e62 100644 --- a/WeaselTSF/CandidateList.cpp +++ b/WeaselTSF/CandidateList.cpp @@ -309,12 +309,14 @@ void CCandidateList::StartUI() { void CCandidateList::EndUI() { com_ptr pThreadMgr = _tsf->_GetThreadMgr(); - com_ptr emgr; - auto hr = pThreadMgr->QueryInterface(&emgr); - if (FAILED(hr)) - return; - if (emgr != NULL) - emgr->EndUIElement(uiid); + if (pThreadMgr) { + com_ptr emgr; + auto hr = pThreadMgr->QueryInterface(&emgr); + if (FAILED(hr)) + return; + if (emgr != NULL) + emgr->EndUIElement(uiid); + } _DisposeUIWindow(); }