mock up grabbedHistories when it doesn't exist.
This commit is contained in:
parent
5cce5d774b
commit
0b5e19ec78
|
@ -73,6 +73,11 @@ namespace NzbDrone.Core.Download
|
||||||
var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId).Where(h => h.EventType == EpisodeHistoryEventType.Grabbed).ToList();
|
var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId).Where(h => h.EventType == EpisodeHistoryEventType.Grabbed).ToList();
|
||||||
var historyItem = grabbedHistories.MaxBy(h => h.Date);
|
var historyItem = grabbedHistories.MaxBy(h => h.Date);
|
||||||
|
|
||||||
|
if (grabbedHistories.Count == 0)
|
||||||
|
{
|
||||||
|
grabbedHistories = new List<EpisodeHistory> { new EpisodeHistory() };
|
||||||
|
}
|
||||||
|
|
||||||
if (historyItem == null && trackedDownload.DownloadItem.Category.IsNullOrWhiteSpace())
|
if (historyItem == null && trackedDownload.DownloadItem.Category.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
trackedDownload.Warn("Download wasn't grabbed by Sonarr and not in a category, Skipping.");
|
trackedDownload.Warn("Download wasn't grabbed by Sonarr and not in a category, Skipping.");
|
||||||
|
|
Loading…
Reference in New Issue