Skip to content

Commit

Permalink
Fix loading of sublangs (regression)
Browse files Browse the repository at this point in the history
Model files which where defined with tessedit_load_sublangs in another
model file where no longer loaded since Tesseract release 5.0.0-rc2.

Fixes: 9091055 ("Fix loading of additional model files")
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 5, 2023
1 parent dfcd485 commit d366e1e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ccmain/tessedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ int Tesseract::init_tesseract(const std::string &arg0, const std::string &textba
// Add any languages that this language requires
bool loaded_primary = false;
// Load the rest into sub_langs_.
// A range based for loop does not work here because langs_to_load
// WARNING: A range based for loop does not work here because langs_to_load
// might be changed in the loop when a new submodel is found.
for (auto &lang_to_load : langs_to_load) {
for (size_t lang_index = 0; lang_index < langs_to_load.size(); ++lang_index) {
auto &lang_to_load = langs_to_load[lang_index];
if (!IsStrInList(lang_to_load, langs_not_to_load)) {
const char *lang_str = lang_to_load.c_str();
Tesseract *tess_to_init;
Expand Down

0 comments on commit d366e1e

Please sign in to comment.