Merge pull request #2642 from mark-monteiro/fix-extras

Add missing null check when retrieving extras
This commit is contained in:
Joshua M. Boniface 2020-03-22 15:10:23 -04:00 committed by GitHub
commit 425bd2b01b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,6 +178,7 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore] [JsonIgnore]
public int? TotalBitrate { get; set; } public int? TotalBitrate { get; set; }
[JsonIgnore] [JsonIgnore]
public ExtraType? ExtraType { get; set; } public ExtraType? ExtraType { get; set; }
@ -2884,7 +2885,7 @@ namespace MediaBrowser.Controller.Entities
public IEnumerable<BaseItem> GetExtras(IReadOnlyCollection<ExtraType> extraTypes) public IEnumerable<BaseItem> GetExtras(IReadOnlyCollection<ExtraType> extraTypes)
{ {
return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null && extraTypes.Contains(i.ExtraType.Value)); return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i?.ExtraType != null && extraTypes.Contains(i.ExtraType.Value));
} }
public IEnumerable<BaseItem> GetTrailers() public IEnumerable<BaseItem> GetTrailers()