1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 11:12:54 +08:00

Use better logic

We need to still perform selection if selectedBeatmap itself is null
This commit is contained in:
Dean Herbert 2017-12-28 12:38:40 +09:00
parent 33480b85c8
commit e4a8402d3c

View File

@ -194,11 +194,14 @@ namespace osu.Game.Screens.Select
if (!Items.Any())
return;
var d = selectedBeatmap?.Drawables.FirstOrDefault();
if (d == null)
DrawableCarouselItem drawable = null;
if (selectedBeatmap != null && (drawable = selectedBeatmap.Drawables.FirstOrDefault()) == null)
// if the selected beatmap isn't present yet, we can't correctly change selection.
// we can fix this by changing this method to not reference drawables / Items in the first place.
return;
int originalIndex = Items.IndexOf(d);
int originalIndex = Items.IndexOf(drawable);
int currentIndex = originalIndex;
// local function to increment the index in the required direction, wrapping over extremities.