diff --git a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs index e539aacad..b908e6669 100644 --- a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs @@ -218,7 +218,7 @@ private class ByLastCharacterComparer : IComparer { public int Compare(string x, string y) { - return x[^1].CompareTo(y[^1]); + return Nullable.Compare(x?[^1], y?[^1]); } } }