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