:bug:修复模式选择下拉框的崩溃bug

This commit is contained in:
Amazing_DM
2020-05-15 20:02:15 +08:00
parent f71b319741
commit debfa76ea2
3 changed files with 61 additions and 52 deletions

View File

@@ -255,7 +255,7 @@ namespace Netch.Forms
private void SaveConfigs() private void SaveConfigs()
{ {
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex; Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
if (ModeComboBox.SelectedItem != null) if (ModeComboBox.Items.Count!=0 && ModeComboBox.SelectedItem != null)
{ {
if (ModeComboBox.Tag is object[] list) if (ModeComboBox.Tag is object[] list)

View File

@@ -1,5 +1,4 @@
using Microsoft.Win32; using System;
using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
@@ -121,9 +120,12 @@ namespace Netch
} }
public static void Application_OnException(object sender, ThreadExceptionEventArgs e) public static void Application_OnException(object sender, ThreadExceptionEventArgs e)
{
if (!e.Exception.ToString().Contains("ComboBox"))
{ {
MessageBox.Show(e.Exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(e.Exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit(); }
//Application.Exit();
} }
} }
} }

View File

@@ -81,6 +81,8 @@ namespace System.Windows.Forms
private string _previousSearchTerm; private string _previousSearchTerm;
private object[] newList; private object[] newList;
private void ReevaluateCompletionList() private void ReevaluateCompletionList()
{
try
{ {
var currentSearchTerm = Text.ToLowerInvariant(); var currentSearchTerm = Text.ToLowerInvariant();
if (currentSearchTerm == _previousSearchTerm) return; if (currentSearchTerm == _previousSearchTerm) return;
@@ -147,5 +149,10 @@ namespace System.Windows.Forms
ResumeLayout(true); ResumeLayout(true);
} }
} }
catch
{
// ignored
}
}
} }
} }