Script Editor: fixed a crash when the find/replace dialog was opened and the previously selected script tabs do not exist anymore. Fixes #993

This commit is contained in:
biwa 2023-12-02 16:18:41 +01:00
parent 53c4952986
commit 124d87129d

View file

@ -174,7 +174,7 @@ namespace CodeImp.DoomBuilder.Windows
findbox.Text = findtext; findbox.Text = findtext;
findbox.SelectAll(); findbox.SelectAll();
findbox.Items.AddRange(findtexts.ToArray()); findbox.Items.AddRange(findtexts.ToArray());
findinbox.SelectedIndex = searchmode; findinbox.SelectedIndex = searchmode > findinbox.Items.Count - 1 ? 0 : searchmode;
findmatchcase.Checked = matchcase; findmatchcase.Checked = matchcase;
findwholeword.Checked = matchwholeword; findwholeword.Checked = matchwholeword;
@ -186,7 +186,7 @@ namespace CodeImp.DoomBuilder.Windows
replacebox.MaxDropDownItems = MAX_DROPDOWN_ITEMS; replacebox.MaxDropDownItems = MAX_DROPDOWN_ITEMS;
replacebox.Text = replacetext; replacebox.Text = replacetext;
replacebox.Items.AddRange(replacetexts.ToArray()); replacebox.Items.AddRange(replacetexts.ToArray());
replaceinbox.SelectedIndex = searchmode; replaceinbox.SelectedIndex = searchmode > replaceinbox.Items.Count - 1 ? 0 : searchmode;
replacematchcase.Checked = matchcase; replacematchcase.Checked = matchcase;
replacewholeword.Checked = matchwholeword; replacewholeword.Checked = matchwholeword;