Add fail-safe to ensure hittability after a hit

This commit is contained in:
smoogipoo 2020-04-17 14:22:03 +09:00
parent 08df9d49e5
commit a4a7823817
1 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
@ -72,6 +73,9 @@ public void HandleHit(DrawableHitObject hitObject)
if (!hitObjectCanBlockFutureHits(hitObject))
return;
if (!IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset))
throw new InvalidOperationException($"A {hitObject} was hit before it become hittable!");
var enumerator = new HitObjectEnumerator(hitObjectContainer, hitObject.HitObject.StartTime);
while (enumerator.MoveNext())