From ae2e3c4a256fb9a2f7851c54114822d1bfbf0316 Mon Sep 17 00:00:00 2001 From: nameoverflow Date: Mon, 26 Feb 2018 12:56:35 +0800 Subject: [PATCH] fix(RimeWithWeasel): fix wild pointer closes #118 --- RimeWithWeasel/RimeWithWeasel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RimeWithWeasel/RimeWithWeasel.cpp b/RimeWithWeasel/RimeWithWeasel.cpp index aa9621fd8..b218622f1 100644 --- a/RimeWithWeasel/RimeWithWeasel.cpp +++ b/RimeWithWeasel/RimeWithWeasel.cpp @@ -459,7 +459,7 @@ bool RimeWithWeaselHandler::_Respond(UINT session_id, EatLine eat) switch (m_ui->style().preedit_type) { case weasel::PREVIEW: - if (ctx.menu.num_candidates > 0) + if (ctx.commit_text_preview != NULL) { std::string first = ctx.commit_text_preview; messages.push_back(std::string("ctx.preedit=") + first + '\n'); @@ -468,7 +468,7 @@ bool RimeWithWeaselHandler::_Respond(UINT session_id, EatLine eat) std::to_string(utf8towcslen(first.c_str(), first.size())) + '\n'); break; } - // no candidates, fall back to composition + // no preview, fall back to composition case weasel::COMPOSITION: messages.push_back(std::string("ctx.preedit=") + ctx.composition.preedit + '\n'); if (ctx.composition.sel_start <= ctx.composition.sel_end)