Avoid crash with --psm 0 and LSTM traineddata

Orientation and script detect only worked with legacy models
and crashed with LSTM models.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-10-08 16:03:54 +02:00
parent 59ebd58fcc
commit 32e92def49

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);