Skip to content

Commit 3634427

Browse files
committed
fix: memorypack warnings in fixedcurve
1 parent 01b4c6e commit 3634427

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/FixedMathSharp/Numerics/FixedCurve.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public FixedCurve(params FixedCurveKey[] keyframes)
4949
[MemoryPackConstructor]
5050
public FixedCurve(FixedCurveMode mode, params FixedCurveKey[] keyframes)
5151
{
52-
Keyframes = keyframes.OrderBy(k => k.Time).ToArray();
52+
Keyframes = keyframes?.Length > 1
53+
? keyframes.OrderBy(k => k.Time).ToArray()
54+
: keyframes?.Clone() as FixedCurveKey[] ?? Array.Empty<FixedCurveKey>();
5355
Mode = mode;
5456
}
5557

@@ -130,9 +132,9 @@ public override int GetHashCode()
130132
}
131133
}
132134

133-
public static bool operator ==(FixedCurve left, FixedCurve right) => left?.Equals(right) ?? right is null;
135+
public static bool operator ==(FixedCurve? left, FixedCurve? right) => left?.Equals(right) ?? right is null;
134136

135-
public static bool operator !=(FixedCurve left, FixedCurve right) => !(left == right);
137+
public static bool operator !=(FixedCurve? left, FixedCurve? right) => !(left == right);
136138

137139
#endregion
138140
}

0 commit comments

Comments
 (0)