diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 3a4e5e04..db695ae9 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -151,7 +151,7 @@ namespace Shadowsocks.View _modifiedConfiguration = controller.GetConfigurationCopy(); LoadConfiguration(_modifiedConfiguration); _lastSelectedIndex = _modifiedConfiguration.index; - if (_lastSelectedIndex < 0) + if (_lastSelectedIndex < 0 || _lastSelectedIndex >= ServersListBox.Items.Count) { _lastSelectedIndex = 0; }