Skip to content

Commit 25e2b82

Browse files
authored
Merge pull request shadowsocks#2543 from Stzx/master
[fixes shadowsocks#2542] Fix accidental index invalidation
2 parents 67e630f + 174cf57 commit 25e2b82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shadowsocks-csharp/View/ConfigForm.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
using System;
1+
using System;
22
using System.Drawing;
33
using System.Windows.Forms;
4+
45
using Shadowsocks.Controller;
56
using Shadowsocks.Model;
67
using Shadowsocks.Properties;
@@ -157,7 +158,7 @@ private bool GetServerDetailsFromUI(out Server server, bool isSave = false, bool
157158

158159
LoadServerNameListToUI(_modifiedConfiguration);
159160

160-
_lastSelectedIndex = (ServersListBox.SelectedIndex = lastIndex);
161+
_lastSelectedIndex = (ServersListBox.SelectedIndex = ( _lastSelectedIndex == ServersListBox.Items.Count ? lastIndex : lastIndex - 1));
161162

162163
ServersListBox.SelectedIndexChanged += ServersListBox_SelectedIndexChanged;
163164
return true;

0 commit comments

Comments
 (0)