Avoid need for implicit null casting

This commit is contained in:
Dean Herbert 2022-11-30 14:20:54 +09:00
parent 0659c84341
commit 2a3b24d058

View File

@ -157,14 +157,12 @@ namespace osu.Game.Screens.Edit.Timing
fill.ChildrenEnumerable = controlPoints fill.ChildrenEnumerable = controlPoints
.Where(matchFunction) .Where(matchFunction)
.Select(createAttribute) .Select(createAttribute)
.Where(c => c != null)
.Select(c => c!)
// arbitrary ordering to make timing points first. // arbitrary ordering to make timing points first.
// probably want to explicitly define order in the future. // probably want to explicitly define order in the future.
.OrderByDescending(c => c.GetType().Name); .OrderByDescending(c => c.GetType().Name);
} }
private Drawable? createAttribute(ControlPoint controlPoint) private Drawable createAttribute(ControlPoint controlPoint)
{ {
switch (controlPoint) switch (controlPoint)
{ {
@ -179,10 +177,9 @@ namespace osu.Game.Screens.Edit.Timing
case SampleControlPoint sample: case SampleControlPoint sample:
return new SampleRowAttribute(sample); return new SampleRowAttribute(sample);
}
default: throw new ArgumentOutOfRangeException(nameof(controlPoint), $"Control point type {controlPoint.GetType()} is not supported");
return null;
}
} }
} }
} }