Fix call when download history can be null

This commit is contained in:
Bogdan 2023-05-09 22:20:25 +03:00
parent 0e6f858e65
commit eeb1cb8861
1 changed files with 2 additions and 2 deletions

View File

@ -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())
{