From eabca016d4011587120b10602137b7ac4f374243 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Sep 2021 22:04:37 +0900 Subject: [PATCH] Throw rather than ignore on invalid control point addition --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 3 +++ osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index dd88d0b539..9d738ecbfb 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -276,6 +276,9 @@ namespace osu.Game.Beatmaps.ControlPoints case EffectControlPoint typed: effectPoints.Add(typed); break; + + default: + throw new ArgumentException($"A control point of unexpected type {controlPoint.GetType()} was added to this {nameof(ControlPointInfo)}"); } } diff --git a/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs b/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs index c790ed0366..2b0a2e7a4d 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs @@ -73,14 +73,16 @@ namespace osu.Game.Beatmaps.Legacy { case SampleControlPoint typed: samplePoints.Add(typed); - break; + return; case DifficultyControlPoint typed: difficultyPoints.Add(typed); + return; + + default: + base.GroupItemAdded(controlPoint); break; } - - base.GroupItemAdded(controlPoint); } protected override void GroupItemRemoved(ControlPoint controlPoint)