From c0a4f3421abbfe999d2e797020b3ff70691135fa Mon Sep 17 00:00:00 2001 From: Logan Zhou Date: Sun, 18 Sep 2016 00:58:02 +0800 Subject: [PATCH] Revert "Updated to meet the hint from Wongsyrone." This reverts commit 84c80535776b981776ee09b2024118c464d22886. --- shadowsocks-csharp/View/ConfigForm.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index d506e8a1..8d2b4781 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -336,13 +336,16 @@ namespace Shadowsocks.View return; } - Server selectedServer = controller.GetCurrentServer(); - Server clone = (Server)selectedServer.Clone(); + if (ServersListBox.SelectedIndex >= 0 && ServersListBox.SelectedIndex < _modifiedConfiguration.configs.Count) + { + Server selectedServer = _modifiedConfiguration.configs[ServersListBox.SelectedIndex]; + Server clone = (Server)selectedServer.Clone(); - _modifiedConfiguration.configs.Add(clone); - LoadConfiguration(_modifiedConfiguration); - ServersListBox.SelectedIndex = _modifiedConfiguration.configs.Count - 1; - _lastSelectedIndex = ServersListBox.SelectedIndex; + _modifiedConfiguration.configs.Add(clone); + LoadConfiguration(_modifiedConfiguration); + ServersListBox.SelectedIndex = _modifiedConfiguration.configs.Count - 1; + _lastSelectedIndex = ServersListBox.SelectedIndex; + } } } }