From eeb1cb8861bf55860d7463c2f1d647e611f1ef64 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 9 May 2023 22:20:25 +0300 Subject: [PATCH] Fix call when download history can be null --- src/NzbDrone.Core/Download/CompletedDownloadService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index 3fd5008cb..556eaa227 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -70,8 +70,8 @@ namespace NzbDrone.Core.Download return; } - var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId).Where(h => h.EventType == EpisodeHistoryEventType.Grabbed).ToList(); - var historyItem = grabbedHistories.MaxBy(h => h.Date); + var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId)?.Where(h => h.EventType == EpisodeHistoryEventType.Grabbed).ToList(); + var historyItem = grabbedHistories?.MaxBy(h => h.Date); if (historyItem == null && trackedDownload.DownloadItem.Category.IsNullOrWhiteSpace()) {