1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Catch exception and return null for safety

.
This commit is contained in:
Dean Herbert 2019-07-02 22:25:51 +09:00
parent 0b66f13902
commit a6acc1f99f

View File

@ -157,7 +157,20 @@ namespace osu.Game.Beatmaps
return b;
}, beatmapCancellation.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default)));
public IBeatmap Beatmap => LoadBeatmapAsync().Result;
public IBeatmap Beatmap
{
get
{
try
{
return LoadBeatmapAsync().Result;
}
catch (TaskCanceledException)
{
return null;
}
}
}
private readonly CancellationTokenSource beatmapCancellation = new CancellationTokenSource();
protected abstract IBeatmap GetBeatmap();