From e2644c384707fedca771ca9b8a08d506865a6a35 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 30 May 2020 10:12:24 -0700 Subject: [PATCH] Fixed manual import possible null series --- .../MediaFiles/EpisodeImport/Manual/ManualImportService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs index 7bcc55af2..fa99ee953 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -353,12 +353,13 @@ public void Execute(ManualImportCommand message) foreach (var groupedTrackedDownload in importedTrackedDownload.GroupBy(i => i.TrackedDownload.DownloadItem.DownloadId).ToList()) { var trackedDownload = groupedTrackedDownload.First().TrackedDownload; + var importedSeries = imported.First().ImportDecision.LocalEpisode.Series; if (_diskProvider.FolderExists(trackedDownload.DownloadItem.OutputPath.FullPath)) { if (_downloadedEpisodesImportService.ShouldDeleteFolder( - new DirectoryInfo(trackedDownload.DownloadItem.OutputPath.FullPath), - trackedDownload.RemoteEpisode.Series) && trackedDownload.DownloadItem.CanMoveFiles) + new DirectoryInfo(trackedDownload.DownloadItem.OutputPath.FullPath), importedSeries) && + trackedDownload.DownloadItem.CanMoveFiles) { _diskProvider.DeleteFolder(trackedDownload.DownloadItem.OutputPath.FullPath, true); } @@ -372,7 +373,7 @@ public void Execute(ManualImportCommand message) if (allEpisodesImported) { trackedDownload.State = TrackedDownloadState.Imported; - _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, imported.First().ImportDecision.LocalEpisode.Series.Id)); + _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importedSeries.Id)); } } }