Skip to content

Commit

Permalink
fix(RimeWithWeasel): fix wild pointer
Browse files Browse the repository at this point in the history
closes #118
  • Loading branch information
nameoverflow committed Feb 26, 2018
1 parent 8a8f864 commit ae2e3c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions RimeWithWeasel/RimeWithWeasel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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)
Expand Down

0 comments on commit ae2e3c4

Please sign in to comment.