Merge pull request #15304 from peppy/fix-editor-new-beatmap-sample-change-crash

Fix editor crash when attempting to change sample/velocity from timeline on new beatmap
This commit is contained in:
Dan Balasescu
2021-10-26 17:13:56 +09:00
committed by GitHub
2 changed files with 9 additions and 0 deletions

View File

@ -56,6 +56,11 @@ namespace osu.Game.Tests.Visual.Editing
checkMutations();
// After placement these must be non-default as defaults are read-only.
AddAssert("Placed object has non-default control points", () =>
editorBeatmap.HitObjects[0].SampleControlPoint != SampleControlPoint.DEFAULT &&
editorBeatmap.HitObjects[0].DifficultyControlPoint != DifficultyControlPoint.DEFAULT);
AddStep("Save", () => InputManager.Keys(PlatformAction.Save));
checkMutations();

View File

@ -119,6 +119,8 @@ namespace osu.Game.Rulesets.Objects
DifficultyControlPoint = (DifficultyControlPoint)legacyInfo.DifficultyPointAt(StartTime).DeepClone();
DifficultyControlPoint.Time = StartTime;
}
else if (DifficultyControlPoint == DifficultyControlPoint.DEFAULT)
DifficultyControlPoint = new DifficultyControlPoint();
ApplyDefaultsToSelf(controlPointInfo, difficulty);
@ -128,6 +130,8 @@ namespace osu.Game.Rulesets.Objects
SampleControlPoint = (SampleControlPoint)legacyInfo.SamplePointAt(this.GetEndTime() + control_point_leniency).DeepClone();
SampleControlPoint.Time = this.GetEndTime() + control_point_leniency;
}
else if (SampleControlPoint == SampleControlPoint.DEFAULT)
SampleControlPoint = new SampleControlPoint();
nestedHitObjects.Clear();