mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-22 01:30:49 +08:00
Classify: Run sort only for more than one element
This fixes calls of qsort with a nullptr argument (reported by sanitizers). Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
5a698c278d
commit
6f6100ff9f
@ -1376,7 +1376,9 @@ int Classify::CharNormTrainingSample(bool pruner_only,
|
||||
for (int i = 0; i < adapt_results->match.size(); i++) {
|
||||
results->push_back(adapt_results->match[i]);
|
||||
}
|
||||
results->sort(&UnicharRating::SortDescendingRating);
|
||||
if (results->size() > 1) {
|
||||
results->sort(&UnicharRating::SortDescendingRating);
|
||||
}
|
||||
}
|
||||
delete [] char_norm_array;
|
||||
delete adapt_results;
|
||||
|
Loading…
Reference in New Issue
Block a user