Fix potential crash related to OCR

This commit is contained in:
WarmUpTill
2023-08-08 21:29:27 +02:00
committed by WarmUpTill
parent 04b2b3474d
commit 0ba7ba77d8

View File

@@ -252,7 +252,9 @@ OCRParameters::OCRParameters(const OCRParameters &other)
colorThreshold(other.colorThreshold),
pageSegMode(other.pageSegMode)
{
Setup();
if (!initDone) {
Setup();
}
if (initDone) {
ocr->SetPageSegMode(pageSegMode);
}
@@ -265,7 +267,12 @@ OCRParameters &OCRParameters::operator=(const OCRParameters &other)
color = other.color;
colorThreshold = other.colorThreshold;
pageSegMode = other.pageSegMode;
ocr->SetPageSegMode(pageSegMode);
if (!initDone) {
Setup();
}
if (initDone) {
ocr->SetPageSegMode(pageSegMode);
}
return *this;
}