1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Add check for spanDuration <= 0 prior to division

This commit is contained in:
Naxess 2021-06-27 15:40:09 +02:00
parent a4a5325b73
commit 9f9e96ce9e

View File

@ -97,6 +97,10 @@ namespace osu.Game.Rulesets.Edit.Checks
if (hitObject is IHasRepeats hasRepeats)
{
double spanDuration = hasRepeats.Duration / hasRepeats.SpanCount();
if (spanDuration <= 0)
// Prevents undefined behaviour in cases like where zero/negative-length sliders/hold notes exist.
return EdgeType.None;
double spans = (time - hitObject.StartTime) / spanDuration;
double acceptableDifference = 1 / spanDuration; // 1 ms of acceptable difference, as with head/tail above.