Skip to content

Commit

Permalink
Replace null-forgiving with diagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Oct 3, 2024
1 parent 8697254 commit 3966487
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions osu.Framework/Graphics/Transforms/TransformSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public readonly ref struct TransformSequence<T>
/// </summary>
private Transform? transform { get; init; }

/// <summary>
/// Whether any transforms have been added to the sequence.
/// </summary>
[MemberNotNullWhen(false, nameof(transform))]
public bool IsEmpty => length == 0;

/// <summary>
Expand Down Expand Up @@ -163,13 +167,13 @@ public TransformSequence<T> Loop(double pause = 0)
/// <param name="numIters">The number of iterations.</param>
public TransformSequence<T> Loop(double pause, int numIters)
{
if (length == 0)
if (IsEmpty)
return this;

Transform[] transformPool = ArrayPool<Transform>.Shared.Rent(length);
Span<Transform> transforms = transformPool[..length];

Transform it = transform!;
Transform it = transform;

for (int i = length - 1; i >= 0; i--)
{
Expand Down

0 comments on commit 3966487

Please sign in to comment.