Skip to content

Commit d0bf9f2

Browse files
committed
fix(script_translator): excluded words cause crashes
1 parent de4700e commit d0bf9f2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/rime/gear/script_translator.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ inline static bool prefer_user_phrase(
569569
}
570570

571571
bool ScriptTranslation::PrepareCandidate() {
572+
iter_incremented:
572573
if (exhausted()) {
573574
candidate_source_ = kUninitialized;
574575
candidate_ = nullptr;
@@ -628,6 +629,10 @@ bool ScriptTranslation::PrepareCandidate() {
628629
return true;
629630
} else if (phrase_code_length > 0) {
630631
DictEntryIterator& iter = phrase_iter_->second;
632+
if (iter.exhausted()) {
633+
++phrase_iter_;
634+
goto iter_incremented;
635+
}
631636
const auto& entry = iter.Peek();
632637
DLOG(INFO) << "phrase '" << entry->text
633638
<< "', code length: " << phrase_code_length;

0 commit comments

Comments
 (0)