diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-05-21 13:05:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-21 13:05:03 +0200 |
| commit | d61530eb4b07ec19116773cdae1bb0d4cfa5d3d5 (patch) | |
| tree | f95281f1b7c50e0f69a94a98a52acc682819a511 /Emby.Server.Implementations/Sorting/ProductionYearComparer.cs | |
| parent | a937a854f2582a8770d9ada7c24375065a21f7a5 (diff) | |
| parent | 7e8428e588b3f0a0574da44081098c64fe1a47d7 (diff) | |
Merge pull request #6083 from Bond-009/nullable4
Enable nullable reference types for Emby.Server.Implementations
Diffstat (limited to 'Emby.Server.Implementations/Sorting/ProductionYearComparer.cs')
| -rw-r--r-- | Emby.Server.Implementations/Sorting/ProductionYearComparer.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs b/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs index e2857df0b..df9f9957d 100644 --- a/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs +++ b/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs @@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting /// <param name="x">The x.</param> /// <param name="y">The y.</param> /// <returns>System.Int32.</returns> - public int Compare(BaseItem x, BaseItem y) + public int Compare(BaseItem? x, BaseItem? y) { return GetValue(x).CompareTo(GetValue(y)); } @@ -25,8 +25,13 @@ namespace Emby.Server.Implementations.Sorting /// </summary> /// <param name="x">The x.</param> /// <returns>DateTime.</returns> - private static int GetValue(BaseItem x) + private static int GetValue(BaseItem? x) { + if (x == null) + { + return 0; + } + if (x.ProductionYear.HasValue) { return x.ProductionYear.Value; |
