mirror of
https://github.com/ppy/osu
synced 2025-03-06 11:28:12 +00:00
Catch exception and return null for safety
.
This commit is contained in:
parent
0b66f13902
commit
a6acc1f99f
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user