Fix getting series by TVDB ID from v5 API

This commit is contained in:
Bogdan 2026-04-21 02:57:19 +03:00 committed by GitHub
parent 2d08abde81
commit eb97bb563b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -78,7 +78,8 @@ public static Dictionary<TKey, TValue> ToDictionaryIgnoreDuplicates<TItem, TKey,
return result;
}
public static void AddIfNotNull<TSource>(this List<TSource> source, TSource item)
#nullable enable
public static void AddIfNotNull<TSource>(this List<TSource> source, TSource? item)
{
if (item == null)
{
@ -87,6 +88,7 @@ public static void AddIfNotNull<TSource>(this List<TSource> source, TSource item
source.Add(item);
}
#nullable disable
public static bool Empty<TSource>(this IEnumerable<TSource> source)
{

View file

@ -115,7 +115,7 @@ public List<SeriesResource> AllSeries(int? tvdbId, [FromQuery] SeriesSubresource
if (tvdbId.HasValue)
{
seriesResources.AddIfNotNull(_seriesService.FindByTvdbId(tvdbId.Value).ToResource(includeSeasonImages));
seriesResources.AddIfNotNull(_seriesService.FindByTvdbId(tvdbId.Value)?.ToResource(includeSeasonImages));
}
else
{