mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Merge pull request #3824 from peppy/fix-no-internet-crashes
Fix update code crashing when no internet connection is available
This commit is contained in:
commit
6ffd2190bc
@ -41,24 +41,32 @@ namespace osu.Desktop.Updater
|
|||||||
|
|
||||||
private async void checkForUpdateAsync()
|
private async void checkForUpdateAsync()
|
||||||
{
|
{
|
||||||
var releases = new JsonWebRequest<GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");
|
try
|
||||||
await releases.PerformAsync();
|
|
||||||
|
|
||||||
var latest = releases.ResponseObject;
|
|
||||||
|
|
||||||
if (latest.TagName != version)
|
|
||||||
{
|
{
|
||||||
notificationOverlay.Post(new SimpleNotification
|
var releases = new JsonWebRequest<GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");
|
||||||
|
|
||||||
|
await releases.PerformAsync();
|
||||||
|
|
||||||
|
var latest = releases.ResponseObject;
|
||||||
|
|
||||||
|
if (latest.TagName != version)
|
||||||
{
|
{
|
||||||
Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n"
|
notificationOverlay.Post(new SimpleNotification
|
||||||
+ "Click here to download the new version, which can be installed over the top of your existing installation",
|
|
||||||
Icon = FontAwesome.fa_upload,
|
|
||||||
Activated = () =>
|
|
||||||
{
|
{
|
||||||
host.OpenUrlExternally(getBestUrl(latest));
|
Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n"
|
||||||
return true;
|
+ "Click here to download the new version, which can be installed over the top of your existing installation",
|
||||||
}
|
Icon = FontAwesome.fa_upload,
|
||||||
});
|
Activated = () =>
|
||||||
|
{
|
||||||
|
host.OpenUrlExternally(getBestUrl(latest));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// we shouldn't crash on a web failure. or any failure for the matter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user