1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Fix out of bounds issues

This commit is contained in:
Dean Herbert 2020-10-19 18:41:17 +09:00
parent 467bb9b96f
commit 044622a7a6

View File

@ -662,7 +662,7 @@ namespace osu.Game.Screens.Select
// as we can't be 100% sure on the size of individual carousel drawables,
// always play it safe and extend bounds by one.
firstIndex = Math.Max(0, firstIndex - 1);
lastIndex = Math.Min(visibleItems.Count, lastIndex + 1);
lastIndex = Math.Clamp(lastIndex + 1, firstIndex, visibleItems.Count - 1);
return (firstIndex, lastIndex);
}