mock up grabbedHistories when it doesn't exist.

This commit is contained in:
Stevie Robinson 2024-01-29 22:56:53 +01:00
parent 5cce5d774b
commit 0b5e19ec78
1 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,11 @@ namespace NzbDrone.Core.Download
var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId).Where(h => h.EventType == EpisodeHistoryEventType.Grabbed).ToList();
var historyItem = grabbedHistories.MaxBy(h => h.Date);
if (grabbedHistories.Count == 0)
{
grabbedHistories = new List<EpisodeHistory> { new EpisodeHistory() };
}
if (historyItem == null && trackedDownload.DownloadItem.Category.IsNullOrWhiteSpace())
{
trackedDownload.Warn("Download wasn't grabbed by Sonarr and not in a category, Skipping.");