Skip to content

Commit

Permalink
Fixes tesseract-ocr#4247: remove unnecessary nullptr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
hribz authored and stweil committed May 23, 2024
1 parent 5d5a633 commit 295468a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/lstm/recodebeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 295468a

Please sign in to comment.