mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Merge pull request #3255 from peppy/catch-cancelled
Catch OperationCanceledException in single file load sequence
This commit is contained in:
commit
a8b20b8b98
@ -504,7 +504,25 @@ namespace osu.Game
|
||||
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
|
||||
// with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile,
|
||||
// we could avoid the need for scheduling altogether.
|
||||
Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(t => LoadComponentAsync(d, add).Wait()) ?? LoadComponentAsync(d, add); });
|
||||
Schedule(() =>
|
||||
{
|
||||
if (asyncLoadStream != null)
|
||||
{
|
||||
//chain with existing load stream
|
||||
asyncLoadStream = asyncLoadStream.ContinueWith(async t =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await LoadComponentAsync(d, add);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
asyncLoadStream = LoadComponentAsync(d, add);
|
||||
});
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
|
Loading…
Reference in New Issue
Block a user