diff --git a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/OcrHelpers.cs b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/OcrHelpers.cs index d6242ded0f..1ed0665f9d 100644 --- a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/OcrHelpers.cs +++ b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/OcrHelpers.cs @@ -22,7 +22,9 @@ public static class OcrHelpers var ocrEngine = OcrEngine.TryCreateFromLanguage(ocrLanguage) ?? throw new InvalidOperationException("Unable to create OCR engine"); var ocrResult = await ocrEngine.RecognizeAsync(bitmap); - return ocrResult.Text; + return string.IsNullOrWhiteSpace(ocrResult.Text) + ? throw new InvalidOperationException("Unable to extract text from image or image does not contain text") + : ocrResult.Text; } private static Language GetOCRLanguage()