From 91442e7eddd755898b4d5afd930e9d8b1d024907 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 4 Nov 2022 17:16:19 +0100 Subject: [PATCH] catch worst-case --- EnvyUpdate/MainWindow.xaml.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index 553dc42..9c0e0db 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -174,11 +174,18 @@ namespace EnvyUpdate //protocol agnostic url gpuURL = "https:" + gpuURL; } - else + else if (gpuURL.StartsWith("driverResults.aspx")) { //relative url gpuURL = "https://www.nvidia.com/Download/" + gpuURL; } + else + { + //panic. + MessageBox.Show("ERROR: Invalid API response from Nvidia. Please file an issue on GitHub."); + Environment.Exit(10); + } + string pContent = c.DownloadString(gpuURL); var pattern = @"Windows\/\d{3}\.\d{2}"; Regex rgx = new Regex(pattern);