diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index cd1c0a08c7..93dc79242e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -34,10 +35,10 @@ namespace osu.Game.Screens.Select.Carousel public IEnumerable DrawableBeatmaps => beatmapContainer?.Children ?? Enumerable.Empty(); - private BeatmapSetInfo beatmapSet => (Item as CarouselBeatmapSet)?.BeatmapSet; - private Container beatmapContainer; + private BeatmapSetInfo beatmapSet; + [Resolved] private BeatmapManager manager { get; set; } @@ -69,6 +70,8 @@ namespace osu.Game.Screens.Select.Carousel if (Item == null) return; + beatmapSet = ((CarouselBeatmapSet)Item).BeatmapSet; + DelayedLoadWrapper background; DelayedLoadWrapper mainFlow; @@ -161,6 +164,8 @@ namespace osu.Game.Screens.Select.Carousel { get { + Debug.Assert(beatmapSet != null); + List items = new List(); if (Item.State.Value == CarouselItemState.NotSelected) @@ -189,6 +194,8 @@ namespace osu.Game.Screens.Select.Carousel private MenuItem createCollectionMenuItem(BeatmapCollection collection) { + Debug.Assert(beatmapSet != null); + TernaryState state; var countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b));