Skip to content

Commit 8b0036c

Browse files
committed
Handle no dictionary words during pass 1 word recognition (issue #4448)
Previously if page_res_it.word()->best_choice == nullptr, dereferencing it in page_res_it.word()->best_choice->permuter() caused a segmentation fault. By checking best_choice != nullptr, i.e. there is a dictionary word, before dereferencing it, the crash is avoided. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
1 parent d3e50cf commit 8b0036c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ccmain/control.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ bool Tesseract::recog_all_words(PAGE_RES *page_res, ETEXT_DESC *monitor,
353353
}
354354

355355
// Count dict words.
356-
if (page_res_it.word()->best_choice->permuter() == USER_DAWG_PERM) {
356+
if (page_res_it.word()->best_choice && page_res_it.word()->best_choice->permuter() == USER_DAWG_PERM) {
357357
++(stats_.dict_words);
358358
}
359359

0 commit comments

Comments
 (0)