From 295ccabf64e81b84cb386b9121f3390a4b132d72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 16:06:12 +0900 Subject: [PATCH] Expand out on to multiple lines --- osu.Game/OsuGame.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 967cf95565..94678a9dde 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -504,16 +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(async t => + Schedule(() => { - try + if (asyncLoadStream != null) { - await LoadComponentAsync(d, add); + //chain with existing load stream + asyncLoadStream = asyncLoadStream.ContinueWith(async t => + { + try + { + await LoadComponentAsync(d, add); + } + catch (OperationCanceledException) + { + } + }); } - catch (OperationCanceledException) - { - } - }) ?? LoadComponentAsync(d, add); }); + else + asyncLoadStream = LoadComponentAsync(d, add); + }); } public bool OnPressed(GlobalAction action)