diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index 8b03fb50b..3c54d5b36 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -110,7 +110,8 @@ namespace MediaBrowser.Api.UserLibrary var itemsList = items.Where(i => i.ProductionYear != null).ToList(); return itemsList - .Select(i => i.ProductionYear.Value) + .Select(i => i.ProductionYear ?? 0) + .Where(i => i > 0) .Distinct() .Select(year => LibraryManager.GetYear(year)); } diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index fc5497fa3..736c70ad5 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -703,7 +703,7 @@ namespace MediaBrowser.Server.Implementations.Library { if (value <= 0) { - throw new ArgumentOutOfRangeException(); + throw new ArgumentOutOfRangeException("Years less than or equal to 0 are invalid."); } return GetItemByName(ConfigurationManager.ApplicationPaths.YearPath, value.ToString(UsCulture));