Fixed crash in translate when offline (now displays error message)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1022 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-03-06 21:23:23 +00:00
parent 1df33d28f8
commit 8afe681dc4

View File

@ -201,7 +201,7 @@ namespace Nikse.SubtitleEdit.Forms
string text = string.Format("{1} {0} |", p.Text.Replace("|", _newlineString), _splitterString);
if (HttpUtility.UrlEncode(sb.ToString() + text).Length >= textMaxSize)
{
FillTranslatedText(DoTranslate(sb.ToString()), start, index-1);
FillTranslatedText(DoTranslate(sb.ToString()), start, index - 1);
sb = new StringBuilder();
progressBar1.Refresh();
Application.DoEvents();
@ -214,7 +214,11 @@ namespace Nikse.SubtitleEdit.Forms
break;
}
if (sb.Length > 0)
FillTranslatedText(DoTranslate(sb.ToString()), start, index-1);
FillTranslatedText(DoTranslate(sb.ToString()), start, index - 1);
}
catch (WebException webException)
{
MessageBox.Show(webException.Source + ": " + webException.Message);
}
finally
{