From 35de19ec3fdf7945091687c39348afcf70302a6d Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 2 Jun 2024 08:41:44 +0200 Subject: [PATCH] Fix auto translate crash - thx soscaster :) Fix #8459 --- src/ui/Forms/Translate/AutoTranslate.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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;