Fix crash in traslate - thx lambdacore12 :)

Fix #8263
This commit is contained in:
Nikolaj Olsson 2024-04-27 19:28:12 +02:00
parent bb9b53a995
commit 1500ab3bb0

View File

@ -704,6 +704,20 @@ namespace Nikse.SubtitleEdit.Forms.Translate
_autoTranslator = GetCurrentEngine();
var engineType = _autoTranslator.GetType();
if (_autoTranslator.Name == DeepLTranslate.StaticName && string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text))
{
MessageBox.Show(this, string.Format(LanguageSettings.Current.GoogleTranslate.XRequiresAnApiKey, _autoTranslator.Name), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
_translationInProgress = false;
return;
}
if (_autoTranslator.Name == DeepLTranslate.StaticName && string.IsNullOrWhiteSpace(nikseComboBoxUrl.Text))
{
MessageBox.Show(this, string.Format("{0} require an url", _autoTranslator.Name), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
_translationInProgress = false;
return;
}
SaveSettings(engineType);
buttonOK.Enabled = false;