Fix weird edge case of nullability in `CarouselRoot`

A bit unfortunately, but it's what we get for having ctor level bindings..
This commit is contained in:
Dean Herbert 2022-09-07 14:27:24 +09:00
parent e18b524f8e
commit f3bda4e040
1 changed files with 3 additions and 2 deletions

View File

@ -1005,7 +1005,8 @@ private class CarouselBoundsItem : CarouselItem
private class CarouselRoot : CarouselGroupEagerSelect
{
private readonly BeatmapCarousel carousel;
// May only be null during construction (State.Value set causes PerformSelection to be triggered).
private readonly BeatmapCarousel? carousel;
public readonly Dictionary<Guid, CarouselBeatmapSet> BeatmapSetsByID = new Dictionary<Guid, CarouselBeatmapSet>();
@ -1048,7 +1049,7 @@ public override void RemoveItem(CarouselItem i)
protected override void PerformSelection()
{
if (LastSelected == null || LastSelected.Filtered.Value)
carousel.SelectNextRandom();
carousel?.SelectNextRandom();
else
base.PerformSelection();
}