From 86eeba3b7df01a41e36b4b27bdd43e737fb5be18 Mon Sep 17 00:00:00 2001 From: noisyfox Date: Mon, 21 Nov 2016 13:50:15 +1100 Subject: [PATCH] Fix crash while showing config dialog. If user manually deleted servers from gui-config.json --- shadowsocks-csharp/View/ConfigForm.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 3a4e5e04..db695ae9 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -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; }