Fixes #4247: remove unnecessary nullptr checks

This commit is contained in:
Yu Xiao 2024-05-23 15:24:48 +08:00 committed by Stefan Weil
parent 5d5a633a5d
commit cf7231f370

View File

@ -899,14 +899,11 @@ void RecodeBeamSearch::ContinueContext(
bool use_dawgs = IsDawgFromBeamsIndex(index);
NodeContinuation prev_cont = ContinuationFromBeamsIndex(index);
for (int p = length - 1; p >= 0; --p, previous = previous->prev) {
while (previous != nullptr &&
(previous->duplicate || previous->code == null_char_)) {
while (previous->duplicate || previous->code == null_char_) {
previous = previous->prev;
}
if (previous != nullptr) {
prefix.Set(p, previous->code);
full_code.Set(p, previous->code);
}
prefix.Set(p, previous->code);
full_code.Set(p, previous->code);
}
if (prev != nullptr && !is_simple_text_) {
if (top_n_flags_[prev->code] == top_n_flag) {