1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Fixed: NullRef on Force Download Unparsable Releases

This commit is contained in:
Qstick 2020-01-26 01:24:10 -05:00
parent 68bfd8bc25
commit 869ce2b366

View File

@ -9,6 +9,7 @@
using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Validation;
using HttpStatusCode = System.Net.HttpStatusCode;
@ -22,6 +23,7 @@ public class ReleaseModule : ReleaseModuleBase
private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
private readonly IDownloadService _downloadService;
private readonly IMovieService _movieService;
private readonly Logger _logger;
private readonly ICached<RemoteMovie> _remoteMovieCache;
@ -31,6 +33,7 @@ public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
IMakeDownloadDecision downloadDecisionMaker,
IPrioritizeDownloadDecision prioritizeDownloadDecision,
IDownloadService downloadService,
IMovieService movieService,
ICacheManager cacheManager,
Logger logger)
{
@ -39,6 +42,7 @@ public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
_downloadDecisionMaker = downloadDecisionMaker;
_prioritizeDownloadDecision = prioritizeDownloadDecision;
_downloadService = downloadService;
_movieService = movieService;
_logger = logger;
PostValidator.RuleFor(s => s.IndexerId).ValidId();
@ -63,6 +67,20 @@ private object DownloadRelease(ReleaseResource release)
try
{
if (remoteMovie.Movie == null)
{
if (release.MovieId.HasValue)
{
var movie = _movieService.GetMovie(release.MovieId.Value);
remoteMovie.Movie = movie;
}
else
{
throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to find matching movie");
}
}
_downloadService.DownloadReport(remoteMovie);
}
catch (ReleaseDownloadException ex)