Skip to content

Commit 4415870

Browse files
committed
fix crash: if press No for download & install UAC #116
1 parent 9066b10 commit 4415870

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: UnityLauncherPro/Tools.cs

+13-3
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,19 @@ public static void DownloadAndInstall(string url, string version)
602602
}
603603
}
604604

605-
Process process = Process.Start(tempFile);
606-
process.EnableRaisingEvents = true;
607-
process.Exited += (sender, e) => DeleteTempFile(tempFile);
605+
Process process;
606+
// if user clicks NO to UAC, this fails (so added try-catch)
607+
try
608+
{
609+
process = Process.Start(tempFile);
610+
process.EnableRaisingEvents = true;
611+
process.Exited += (sender, e) => DeleteTempFile(tempFile);
612+
}
613+
catch (Exception)
614+
{
615+
Console.WriteLine("Failed to run exe: " + tempFile);
616+
DeleteTempFile(tempFile);
617+
}
608618
// TODO refresh upgrade dialog after installer finished
609619
}
610620
}

0 commit comments

Comments
 (0)