From 86e78659b67d80895db6c73ec9b7b18eea8e43c6 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sun, 26 May 2013 17:42:14 +0000 Subject: [PATCH] Better error handling in new ocr git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1842 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Forms/VobSubOcr.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Forms/VobSubOcr.cs b/src/Forms/VobSubOcr.cs index c4eeee16c..9bdb7098f 100644 --- a/src/Forms/VobSubOcr.cs +++ b/src/Forms/VobSubOcr.cs @@ -3724,6 +3724,13 @@ namespace Nikse.SubtitleEdit.Forms if (_nocrChars == null) LoadNOcrWithCurrentLanguage(); + if (_nocrChars == null) + { + MessageBox.Show("Fatal - No NOCR dictionary loaded!"); + SetButtonsEnabledAfterOcrDone(); + return; + } + _nocrThreadsStop = false; _nocrThreads = new List(); _nocrThreadResults = new string[_subtitle.Paragraphs.Count]; @@ -3839,9 +3846,12 @@ namespace Nikse.SubtitleEdit.Forms private void LoadNOcrWithCurrentLanguage() { string fileName = GetNOcrLanguageFileName(); - LoadNOcr(fileName, true); - fileName = fileName.Insert(fileName.Length - 4, "_User"); - LoadNOcr(fileName, false); + if (!string.IsNullOrEmpty(fileName)) + { + LoadNOcr(fileName, true); + fileName = fileName.Insert(fileName.Length - 4, "_User"); + LoadNOcr(fileName, false); + } } internal void SaveNOcrWithCurrentLanguage()