From c3f4771f4d041c7d7890518c0dd973f6fef5a78d Mon Sep 17 00:00:00 2001 From: Nekromateion <43814053+Nekromateion@users.noreply.github.com> Date: Wed, 7 Aug 2024 10:54:30 +0200 Subject: [PATCH] Add error message for invalid proxy server (#862) --- Dotnet/WebApi.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Dotnet/WebApi.cs b/Dotnet/WebApi.cs index 86953f89..440c44de 100644 --- a/Dotnet/WebApi.cs +++ b/Dotnet/WebApi.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Cookie = System.Net.Cookie; +using System.Windows; namespace VRCX { @@ -70,9 +71,18 @@ namespace VRCX if (string.IsNullOrEmpty(ProxyUrl)) return; - - ProxySet = true; - Proxy = new WebProxy(ProxyUrl); + + try + { + ProxySet = true; + Proxy = new WebProxy(ProxyUrl); + } + catch (UriFormatException) + { + VRCXStorage.Instance.Set("VRCX_ProxyServer", string.Empty); + MessageBox.Show("The proxy server URI you used is invalid.\nVRCX will close, please correct the proxy URI.", "Invalid Proxy URI", MessageBoxButton.OK); + Environment.Exit(0); + } } internal void Exit()