1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 21:52:57 +08:00

Fix potential div-by-zero

This commit is contained in:
Andrei Zavatski
2025-07-18 15:55:33 +03:00
Unverified
parent 0f2a078447
commit 04cd91bd36
@@ -90,21 +90,21 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
private float triangleScreenSpaceHeight;
private Vector2 inflation;
public override void ApplyState()
{
base.ApplyState();
triangleScreenSpaceHeight = ScreenSpaceDrawQuad.Width * Source.TriangleHeightRatio;
inflation = new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / (DrawRectangle.Width * Source.TriangleHeightRatio));
}
protected override void Blit(IRenderer renderer)
{
if (triangleScreenSpaceHeight == 0)
if (triangleScreenSpaceHeight == 0 || DrawRectangle.Width == 0 || DrawRectangle.Height == 0)
return;
Vector2 inflation = new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / (DrawRectangle.Width * Source.TriangleHeightRatio));
Quad topTriangle = new Quad
(
ScreenSpaceDrawQuad.TopLeft,