Browse Source

Fix accidental index invalidation

Fixed an invalid index that was unexpectedly caused when the configuration was abandoned, resulting in an list box index exception.
tags/4.1.8.0
Stzx 5 years ago
parent
commit
174cf57111
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      shadowsocks-csharp/View/ConfigForm.cs

+ 3
- 2
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -1,6 +1,7 @@
using System;
using System;
using System.Drawing;
using System.Windows.Forms;
using Shadowsocks.Controller;
using Shadowsocks.Model;
using Shadowsocks.Properties;
@@ -157,7 +158,7 @@ namespace Shadowsocks.View
LoadServerNameListToUI(_modifiedConfiguration);
_lastSelectedIndex = (ServersListBox.SelectedIndex = lastIndex);
_lastSelectedIndex = (ServersListBox.SelectedIndex = ( _lastSelectedIndex == ServersListBox.Items.Count ? lastIndex : lastIndex - 1));
ServersListBox.SelectedIndexChanged += ServersListBox_SelectedIndexChanged;
return true;


Loading…
Cancel
Save