1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:33:02 +08:00

Safeguard againts multiple ApplyResult() invocations

This commit is contained in:
smoogipoo 2020-10-01 21:33:54 +09:00
parent 73edb87363
commit d7f9b8045c

View File

@ -469,6 +469,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <param name="application">The callback that applies changes to the <see cref="JudgementResult"/>.</param> /// <param name="application">The callback that applies changes to the <see cref="JudgementResult"/>.</param>
protected void ApplyResult(Action<JudgementResult> application) protected void ApplyResult(Action<JudgementResult> application)
{ {
if (Result.HasResult)
throw new InvalidOperationException($"Cannot apply result on a hitobject that already has a result.");
application?.Invoke(Result); application?.Invoke(Result);
if (!Result.HasResult) if (!Result.HasResult)