mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 09:17:36 +13:00
Make sure inputs not null
This commit is contained in:
parent
7196c9a6a1
commit
3eade4e4cc
1 changed files with 5 additions and 3 deletions
|
@ -1077,7 +1077,7 @@ public static void OCRImage(string filePath)
|
|||
}
|
||||
}
|
||||
|
||||
public static void OCRImage(Stream stream, string fileName, string filePath = "")
|
||||
public static void OCRImage(Stream stream, string fileName, string filePath = null)
|
||||
{
|
||||
if (stream != null)
|
||||
{
|
||||
|
@ -1086,9 +1086,11 @@ public static void OCRImage(Stream stream, string fileName, string filePath = ""
|
|||
form.Language = Program.Settings.OCRLanguage;
|
||||
form.ShowDialog();
|
||||
Program.Settings.OCRLanguage = form.Language;
|
||||
if (filePath != "")
|
||||
|
||||
if (!string.IsNullOrEmpty(form.Result) && !string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
File.WriteAllText(Path.ChangeExtension(filePath, ".txt"), form.Result, Encoding.UTF8);
|
||||
string textPath = Path.ChangeExtension(filePath, "txt");
|
||||
File.WriteAllText(textPath, form.Result, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue