diff --git a/src/ui/Forms/Translate/AutoTranslate.cs b/src/ui/Forms/Translate/AutoTranslate.cs index be68f7e8a..ff3a288c0 100644 --- a/src/ui/Forms/Translate/AutoTranslate.cs +++ b/src/ui/Forms/Translate/AutoTranslate.cs @@ -520,8 +520,14 @@ namespace Nikse.SubtitleEdit.Forms.Translate var i = 0; var threeLetterLanguageCode = Iso639Dash2LanguageCode.GetThreeLetterCodeFromTwoLetterCode(languageIsoCode); - foreach (TranslationPair item in comboBox.Items) + foreach (var comboBoxItem in comboBox.Items) { + var item = comboBoxItem as TranslationPair; + if (item == null) + { + continue; + } + if (!string.IsNullOrEmpty(item.TwoLetterIsoLanguageName) && item.TwoLetterIsoLanguageName == languageIsoCode) { comboBox.SelectedIndex = i;