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:
parent
35b0ff80bb
commit
47747aed3e
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user