From 0b5e19ec7864991dc53bb1036d914e9269718ee6 Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Mon, 29 Jan 2024 22:56:53 +0100 Subject: [PATCH] mock up grabbedHistories when it doesn't exist. --- src/NzbDrone.Core/Download/CompletedDownloadService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index 82a4c2eb8..73631db4a 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -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 { new EpisodeHistory() }; + } + if (historyItem == null && trackedDownload.DownloadItem.Category.IsNullOrWhiteSpace()) { trackedDownload.Warn("Download wasn't grabbed by Sonarr and not in a category, Skipping.");