Prevented #2848 from erroring out causing further issues.

pull/2900/head
TidusJar 6 years ago
parent 6a36fa3974
commit d1086e8ae0

@ -2,6 +2,7 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Ombi.Core.Models.Search;
using Ombi.Store.Entities;
using Ombi.Store.Repository.Requests;
@ -33,9 +34,12 @@ namespace Ombi.Core.Rule.Rules.Search
}
public static async Task SingleEpisodeCheck(bool useImdb, IQueryable<PlexEpisode> allEpisodes, EpisodeRequests episode,
SeasonRequests season, PlexServerContent item, bool useTheMovieDb, bool useTvDb)
SeasonRequests season, PlexServerContent item, bool useTheMovieDb, bool useTvDb, ILogger log)
{
PlexEpisode epExists = null;
try
{
if (useImdb)
{
epExists = await allEpisodes.FirstOrDefaultAsync(x =>
@ -56,6 +60,11 @@ namespace Ombi.Core.Rule.Rules.Search
x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
x.Series.TvDbId == item.TvDbId);
}
}
catch (Exception e)
{
log.LogError(e, "Exception thrown when attempting to check if something is available");
}
if (epExists != null)
{

Loading…
Cancel
Save