1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:43:22 +08:00

Merge pull request #24577 from OliBomby/null-tracking

Fix tracking on empty control point groups
This commit is contained in:
Dean Herbert 2023-08-18 18:00:59 +09:00 committed by GitHub
commit f51e2a92a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,13 +147,25 @@ namespace osu.Game.Screens.Edit.Timing
trackedType = null;
else
{
// If the selected group only has one control point, update the tracking type.
if (selectedGroup.Value.ControlPoints.Count == 1)
trackedType = selectedGroup.Value?.ControlPoints.Single().GetType();
// If the selected group has more than one control point, choose the first as the tracking type
// if we don't already have a singular tracked type.
else if (trackedType == null)
trackedType = selectedGroup.Value?.ControlPoints.FirstOrDefault()?.GetType();
switch (selectedGroup.Value.ControlPoints.Count)
{
// If the selected group has no control points, clear the tracked type.
// Otherwise the user will be unable to select a group with no control points.
case 0:
trackedType = null;
break;
// If the selected group only has one control point, update the tracking type.
case 1:
trackedType = selectedGroup.Value?.ControlPoints.Single().GetType();
break;
// If the selected group has more than one control point, choose the first as the tracking type
// if we don't already have a singular tracked type.
default:
trackedType ??= selectedGroup.Value?.ControlPoints.FirstOrDefault()?.GetType();
break;
}
}
if (trackedType != null)