Fix crash while showing config dialog.

If user manually deleted servers from gui-config.json
This commit is contained in:
noisyfox
2016-11-21 13:50:15 +11:00
parent 6df3250a9f
commit 86eeba3b7d
+1 -1
View File
@@ -151,7 +151,7 @@ namespace Shadowsocks.View
_modifiedConfiguration = controller.GetConfigurationCopy();
LoadConfiguration(_modifiedConfiguration);
_lastSelectedIndex = _modifiedConfiguration.index;
if (_lastSelectedIndex < 0)
if (_lastSelectedIndex < 0 || _lastSelectedIndex >= ServersListBox.Items.Count)
{
_lastSelectedIndex = 0;
}