1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Clamp index to valid bounds

This commit is contained in:
Dean Herbert 2020-11-10 18:08:12 +09:00
parent 2e3dc6fc46
commit 833c0b223e

View File

@ -189,7 +189,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
public void HideBar() => bar.FadeOut(fade_duration);
private int calculateIndex(float mouseXPosition) => (int)MathF.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1));
private int calculateIndex(float mouseXPosition) => (int)Math.Clamp(MathF.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1)), 0, DefaultValueCount - 1);
private Vector2 calculateBallPosition(int index)
{