Fix selected legacy skins crashing on zero-length hold notes

Closes https://github.com/ppy/osu/issues/27134.
This commit is contained in:
Bartłomiej Dach 2024-02-12 08:33:08 +01:00
parent 7bc571dd51
commit 36005a5449
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -243,7 +243,9 @@ protected override void Update()
bodySprite.FillMode = FillMode.Stretch;
// i dunno this looks about right??
bodySprite.Scale = new Vector2(1, scaleDirection * 32800 / sprite.DrawHeight);
// the guard against zero draw height is intended for zero-length hold notes. yes, such cases have been spotted in the wild.
if (sprite.DrawHeight > 0)
bodySprite.Scale = new Vector2(1, scaleDirection * 32800 / sprite.DrawHeight);
}
break;