From 5eaa5cf78ca26082ab56605c56e8a3768ac3f412 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Tue, 3 Jul 2018 19:44:30 +0100 Subject: [PATCH] Fixed #2371 --- src/Ombi.Core/Senders/TvSender.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index 12124d270..2cccd6778 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -255,7 +255,12 @@ namespace Ombi.Core.Senders { // We have the same amount of requests as all of the episodes in the season. var existingSeason = - result.seasons.First(x => x.seasonNumber == season.SeasonNumber); + result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber); + if (existingSeason == null) + { + Logger.LogError("The sonarr ep count was the same as out request count, but could not match the season number {0}", season.SeasonNumber); + continue; + } existingSeason.monitored = true; seriesChanges = true; }