Merge pull request #4220 from Spacetech/TvdbEpisodeImageProvider_nullable_check

Fix invalid operation exception in TvdbEpisodeImageProvider.GetImages
pull/4243/head
dkanada 4 years ago committed by GitHub
commit c94d774ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,21 +57,28 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
// Process images // Process images
try try
{ {
var episodeInfo = new EpisodeInfo string episodeTvdbId = null;
if (episode.IndexNumber.HasValue && episode.ParentIndexNumber.HasValue)
{ {
IndexNumber = episode.IndexNumber.Value, var episodeInfo = new EpisodeInfo
ParentIndexNumber = episode.ParentIndexNumber.Value, {
SeriesProviderIds = series.ProviderIds, IndexNumber = episode.IndexNumber.Value,
SeriesDisplayOrder = series.DisplayOrder ParentIndexNumber = episode.ParentIndexNumber.Value,
}; SeriesProviderIds = series.ProviderIds,
string episodeTvdbId = await _tvdbClientManager SeriesDisplayOrder = series.DisplayOrder
.GetEpisodeTvdbId(episodeInfo, language, cancellationToken).ConfigureAwait(false); };
episodeTvdbId = await _tvdbClientManager
.GetEpisodeTvdbId(episodeInfo, language, cancellationToken).ConfigureAwait(false);
}
if (string.IsNullOrEmpty(episodeTvdbId)) if (string.IsNullOrEmpty(episodeTvdbId))
{ {
_logger.LogError( _logger.LogError(
"Episode {SeasonNumber}x{EpisodeNumber} not found for series {SeriesTvdbId}", "Episode {SeasonNumber}x{EpisodeNumber} not found for series {SeriesTvdbId}",
episodeInfo.ParentIndexNumber, episode.ParentIndexNumber,
episodeInfo.IndexNumber, episode.IndexNumber,
series.GetProviderId(MetadataProvider.Tvdb)); series.GetProviderId(MetadataProvider.Tvdb));
return imageResult; return imageResult;
} }

Loading…
Cancel
Save