Skip to content

Commit

Permalink
Merge pull request #2543 from Stzx/master
Browse files Browse the repository at this point in the history
[fixes #2542] Fix accidental index invalidation
  • Loading branch information
celeron533 authored Sep 5, 2019
2 parents 67e630f + 174cf57 commit 25e2b82
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shadowsocks-csharp/View/ConfigForm.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System;
using System.Drawing;
using System.Windows.Forms;

using Shadowsocks.Controller;
using Shadowsocks.Model;
using Shadowsocks.Properties;
Expand Down Expand Up @@ -157,7 +158,7 @@ private bool GetServerDetailsFromUI(out Server server, bool isSave = false, bool

LoadServerNameListToUI(_modifiedConfiguration);

_lastSelectedIndex = (ServersListBox.SelectedIndex = lastIndex);
_lastSelectedIndex = (ServersListBox.SelectedIndex = ( _lastSelectedIndex == ServersListBox.Items.Count ? lastIndex : lastIndex - 1));

ServersListBox.SelectedIndexChanged += ServersListBox_SelectedIndexChanged;
return true;
Expand Down

0 comments on commit 25e2b82

Please sign in to comment.