From 16c993579bf943cb8ca71e89654e4ffd1115302c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 8 Jul 2019 17:10:12 +0900 Subject: [PATCH] Fix track transfer not running when beatmap is retrieved from cache --- osu.Game/Beatmaps/BeatmapManager.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 7ef50da7d3..5031176790 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -180,19 +180,18 @@ namespace osu.Game.Beatmaps lock (workingCache) { - var cached = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID); + var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID); - if (cached != null) - return cached; + if (working == null) + { + if (beatmapInfo.Metadata == null) + beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - if (beatmapInfo.Metadata == null) - beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; - - WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager); + workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store, + new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager)); + } previous?.TransferTo(working); - workingCache.Add(working); - return working; } }