From f66638d14ca798d30564c749ffdc71579952eba9 Mon Sep 17 00:00:00 2001 From: noisyfox Date: Thu, 15 Dec 2016 16:51:23 +1100 Subject: [PATCH] Don't check and throw exception in a display function. We should check this at input side. --- shadowsocks-csharp/Model/Server.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shadowsocks-csharp/Model/Server.cs b/shadowsocks-csharp/Model/Server.cs index 694effe0..fcdb82af 100755 --- a/shadowsocks-csharp/Model/Server.cs +++ b/shadowsocks-csharp/Model/Server.cs @@ -45,9 +45,7 @@ namespace Shadowsocks.Model string serverStr; // CheckHostName() won't do a real DNS lookup var hostType = Uri.CheckHostName( server ); - if ( hostType == UriHostNameType.Unknown ) { - throw new FormatException("Invalid Server Address."); - } + switch ( hostType ) { case UriHostNameType.IPv6: serverStr = $"[{server}]:{server_port}";