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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user