Skip to content

Commit

Permalink
Fix NRE with Resolutions in Filters
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Jan 10, 2024
1 parent 46f56a5 commit b8e483d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Shoko.Server/Filters/FilterExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ public static Filterable ToFilterable(this SVR_AnimeSeries series, ILookup<int,
return subtitles;
},
ResolutionsDelegate = () =>
series.GetVideoLocals().Select(a => MediaInfoUtils.GetStandardResolution(Tuple.Create(a.Media.VideoStream.Width, a.Media.VideoStream.Height)))
.ToHashSet(),
FilePathsDelegate = () =>
series.GetVideoLocals().Select(a => a.GetBestVideoLocalPlace().FilePath)
.ToHashSet()
series.GetVideoLocals().Where(a => a.Media?.VideoStream != null).Select(a =>
MediaInfoUtils.GetStandardResolution(Tuple.Create(a.Media.VideoStream.Width, a.Media.VideoStream.Height))).ToHashSet(),
FilePathsDelegate = () => series.GetVideoLocals().Select(a => a.GetBestVideoLocalPlace().FilePath).ToHashSet()
};

return filterable;
Expand Down Expand Up @@ -268,8 +266,9 @@ public static Filterable ToFilterable(this SVR_AnimeGroup group, ILookup<int, Cr
subtitles = subtitleLanguageNames.Aggregate((a, b) => a.Intersect(b, StringComparer.InvariantCultureIgnoreCase)).ToHashSet();
return subtitles;
},
ResolutionsDelegate = () => series.SelectMany(a => a.GetVideoLocals()).Select(a =>
MediaInfoUtils.GetStandardResolution(Tuple.Create(a.Media.VideoStream.Width, a.Media.VideoStream.Height))).ToHashSet(),
ResolutionsDelegate =
() => series.SelectMany(a => a.GetVideoLocals()).Where(a => a.Media?.VideoStream != null).Select(a =>
MediaInfoUtils.GetStandardResolution(Tuple.Create(a.Media.VideoStream.Width, a.Media.VideoStream.Height))).ToHashSet(),
FilePathsDelegate = () => series.SelectMany(s => s.GetVideoLocals().Select(a => a.GetBestVideoLocalPlace().FilePath)).ToHashSet()
};

Expand Down

0 comments on commit b8e483d

Please sign in to comment.