Jelajahi Sumber

Avoid frequent Exception

softworkz 9 tahun lalu
induk
melakukan
05b53d1f30

+ 4 - 5
MediaBrowser.Server.Implementations/Connect/ConnectManager.cs

@@ -65,12 +65,11 @@ namespace MediaBrowser.Server.Implementations.Connect
 
                 if (!string.IsNullOrWhiteSpace(address))
                 {
-                    try
-                    {
-                        address = new Uri(address).Host;
-                    }
-                    catch
+                    Uri newUri;
+
+                    if (Uri.TryCreate(address, UriKind.Absolute, out newUri))
                     {
+                        address = newUri.Host;
                     }
                 }