From 3eab8248e61841fd6e9810352682e1dc50d7d086 Mon Sep 17 00:00:00 2001 From: Mitchell Cash Date: Tue, 13 Jun 2017 16:40:51 +1000 Subject: [PATCH] Fixed: Error when processing manual import decisions (#1670) --- .../MediaFiles/EpisodeImport/ImportDecisionMaker.cs | 5 +++++ .../EpisodeImport/Manual/ManualImportService.cs | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs index e9895e542..e114d8bef 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs @@ -368,6 +368,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport decision = new ImportDecision(localEpisode, new Rejection("Unexpected error processing file")); } + if (decision == null) + { + _logger.Error("Unable to make a decision on {0}", file); + } + return decision; } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs index 671d3139a..1f117b525 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -160,7 +160,17 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual var importDecisions = _importDecisionMaker.GetImportDecisions(new List { file }, movie, null, SceneSource(movie, folder), true); - return importDecisions.Any() ? MapItem(importDecisions.First(), folder, downloadId) : null; + return importDecisions.Any() ? MapItem(importDecisions.First(), folder, downloadId) : new ManualImportItem + { + DownloadId = downloadId, + Path = file, + RelativePath = folder.GetRelativePath(file), + Name = Path.GetFileNameWithoutExtension(file), + Rejections = new List + { + new Rejection("Unable to process file") + } + }; } //private ManualImportItem ProcessFile(string file, string downloadId, string folder = null)