Skip to content

Commit 48976a0

Browse files
committed
catch webexception if cannot find update server
1 parent c1e1ae4 commit 48976a0

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Diff for: UnityLauncherPro/GetUnityUpdates.cs

+14-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,24 @@ public static async Task<string> Scan()
2121

2222
isDownloadingUnityList = true;
2323
//SetStatus("Downloading list of Unity versions ...");
24-
string result;
24+
string result = null;
2525
// download list of Unity versions
2626
using (WebClient webClient = new WebClient())
2727
{
28-
2928
Task<string> downloadStringTask = webClient.DownloadStringTaskAsync(new Uri(unityVersionsURL));
30-
result = await downloadStringTask;
29+
try
30+
{
31+
result = await downloadStringTask;
32+
}
33+
catch (WebException)
34+
{
35+
Console.WriteLine("It's a web exception");
36+
}
37+
catch (Exception)
38+
{
39+
Console.WriteLine("It's not a web exception");
40+
}
41+
3142
isDownloadingUnityList = false;
3243
}
3344
return result;

0 commit comments

Comments
 (0)