mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-10 02:21:05 -05:00
Prevent crash when OCR traineddata file is missing
This commit is contained in:
parent
f42025c981
commit
f4f92b29bf
|
|
@ -231,10 +231,9 @@ std::optional<std::string> RunOCR(tesseract::TessBaseAPI *ocr,
|
|||
const QImage &image, const QColor &color,
|
||||
double colorDiff)
|
||||
{
|
||||
(void)ocr;
|
||||
(void)color;
|
||||
(void)colorDiff;
|
||||
if (image.isNull()) {
|
||||
if (!ocr || image.isNull()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,10 @@ public:
|
|||
void SetCustomConfigFile(const std::string &);
|
||||
std::string GetCustomConfigFile() const { return configFile; }
|
||||
tesseract::PageSegMode GetPageMode() const { return pageSegMode; }
|
||||
tesseract::TessBaseAPI *GetOCR() const { return ocr.get(); }
|
||||
tesseract::TessBaseAPI *GetOCR() const
|
||||
{
|
||||
return initDone ? ocr.get() : nullptr;
|
||||
}
|
||||
|
||||
StringVariable text = obs_module_text("AdvSceneSwitcher.enterText");
|
||||
RegexConfig regex = RegexConfig::PartialMatchRegexConfig();
|
||||
|
|
|
|||
|
|
@ -391,6 +391,7 @@ void PreviewImage::MarkOCRMatch(QImage &screenshot,
|
|||
if (!text) {
|
||||
emit StatusUpdate(obs_module_text(
|
||||
"AdvSceneSwitcher.condition.video.ocrMatchFail"));
|
||||
return;
|
||||
}
|
||||
|
||||
QString status(obs_module_text(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user