From 04cd91bd36a185e7ea3f800257cdcb2210ec8122 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 18 Jul 2025 15:55:33 +0300 Subject: [PATCH] Fix potential div-by-zero --- .../Edit/Compose/Components/Timeline/CentreMarker.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs index ec6c742b6b..145049e1dd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs @@ -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,