1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 21:40:34 +08:00

Add guards to prevent clamp calls with invalid bounds

This commit is contained in:
Bartłomiej Dach 2025-03-03 08:40:51 +01:00
parent 35b0ff80bb
commit 47747aed3e
No known key found for this signature in database

View File

@ -277,17 +277,17 @@ namespace osu.Game.Screens.Play
if (rulesetComponents != null)
processDrawables(rulesetComponents);
if (lowestTopScreenSpaceRight.HasValue)
if (lowestTopScreenSpaceRight.HasValue && DrawHeight - TopRightElements.DrawHeight > 0)
TopRightElements.Y = Math.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceRight.Value)).Y, 0, DrawHeight - TopRightElements.DrawHeight);
else
TopRightElements.Y = 0;
if (lowestTopScreenSpaceLeft.HasValue)
if (lowestTopScreenSpaceLeft.HasValue && DrawHeight - LeaderboardFlow.DrawHeight > 0)
LeaderboardFlow.Y = Math.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceLeft.Value)).Y, 0, DrawHeight - LeaderboardFlow.DrawHeight);
else
LeaderboardFlow.Y = 0;
if (highestBottomScreenSpace.HasValue)
if (highestBottomScreenSpace.HasValue && DrawHeight - bottomRightElements.DrawHeight > 0)
bottomRightElements.Y = BottomScoringElementsHeight = -Math.Clamp(DrawHeight - ToLocalSpace(highestBottomScreenSpace.Value).Y, 0, DrawHeight - bottomRightElements.DrawHeight);
else
bottomRightElements.Y = 0;