mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09: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;
|
return b;
|
||||||
}, beatmapCancellation.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default)));
|
}, 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();
|
private readonly CancellationTokenSource beatmapCancellation = new CancellationTokenSource();
|
||||||
protected abstract IBeatmap GetBeatmap();
|
protected abstract IBeatmap GetBeatmap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user