Merge pull request #1964 from stweil/fix

Avoid crash with --psm 0 and LSTM traineddata
This commit is contained in:
zdenop 2018-10-08 18:45:37 +02:00 committed by GitHub
commit ab39adbcab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1541,6 +1541,10 @@ void Classify::DoAdaptiveMatch(TBLOB *Blob, ADAPT_RESULTS *Results) {
&bl_features);
if (sample == nullptr) return;
// TODO: With LSTM, static_classifier_ is nullptr.
// Return to avoid crash in CharNormClassifier.
if (static_classifier_ == nullptr) return;
if (AdaptedTemplates->NumPermClasses < matcher_permanent_classes_min ||
tess_cn_matching) {
CharNormClassifier(Blob, *sample, Results);