From 46483622149904c9240f6f6e53ba4ef283edb07d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 29 Jul 2020 11:30:25 +0900 Subject: [PATCH] Safeguard against potential finalise-before-initialised --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index 58b96b08b0..b80b4e45ed 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -136,10 +136,13 @@ namespace osu.Game.Beatmaps trackedUpdateCancellationSource?.Cancel(); trackedUpdateCancellationSource = null; - foreach (var c in linkedCancellationSources) - c.Dispose(); + if (linkedCancellationSources != null) + { + foreach (var c in linkedCancellationSources) + c.Dispose(); - linkedCancellationSources.Clear(); + linkedCancellationSources.Clear(); + } } /// @@ -239,7 +242,7 @@ namespace osu.Game.Beatmaps base.Dispose(isDisposing); cancelTrackedBindableUpdate(); - updateScheduler.Dispose(); + updateScheduler?.Dispose(); } private readonly struct DifficultyCacheLookup : IEquatable