mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Add nullptr check in for statement of function RecodeBeamSearch::ContinueContext
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
cf7231f370
commit
5712e16957
@ -898,12 +898,13 @@ void RecodeBeamSearch::ContinueContext(
|
||||
int length = LengthFromBeamsIndex(index);
|
||||
bool use_dawgs = IsDawgFromBeamsIndex(index);
|
||||
NodeContinuation prev_cont = ContinuationFromBeamsIndex(index);
|
||||
for (int p = length - 1; p >= 0; --p, previous = previous->prev) {
|
||||
for (int p = length - 1; p >= 0 && previous != nullptr; --p) {
|
||||
while (previous->duplicate || previous->code == null_char_) {
|
||||
previous = previous->prev;
|
||||
}
|
||||
prefix.Set(p, previous->code);
|
||||
full_code.Set(p, previous->code);
|
||||
previous = previous->prev;
|
||||
}
|
||||
if (prev != nullptr && !is_simple_text_) {
|
||||
if (top_n_flags_[prev->code] == top_n_flag) {
|
||||
|
Loading…
Reference in New Issue
Block a user