Fix auto translate crash - thx soscaster :)

Fix  #8459
This commit is contained in:
Nikolaj Olsson 2024-06-02 08:41:44 +02:00
parent 134415f639
commit 35de19ec3f

View File

@ -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;