Fixed: NullRef on Force Download Unparsable Releases

pull/2/head
Qstick 5 years ago
parent 68bfd8bc25
commit 869ce2b366

@ -9,6 +9,7 @@ using NzbDrone.Core.Download;
using NzbDrone.Core.Exceptions; using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.IndexerSearch; using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
using HttpStatusCode = System.Net.HttpStatusCode; using HttpStatusCode = System.Net.HttpStatusCode;
@ -22,6 +23,7 @@ namespace Radarr.Api.V3.Indexers
private readonly IMakeDownloadDecision _downloadDecisionMaker; private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision; private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
private readonly IDownloadService _downloadService; private readonly IDownloadService _downloadService;
private readonly IMovieService _movieService;
private readonly Logger _logger; private readonly Logger _logger;
private readonly ICached<RemoteMovie> _remoteMovieCache; private readonly ICached<RemoteMovie> _remoteMovieCache;
@ -31,6 +33,7 @@ namespace Radarr.Api.V3.Indexers
IMakeDownloadDecision downloadDecisionMaker, IMakeDownloadDecision downloadDecisionMaker,
IPrioritizeDownloadDecision prioritizeDownloadDecision, IPrioritizeDownloadDecision prioritizeDownloadDecision,
IDownloadService downloadService, IDownloadService downloadService,
IMovieService movieService,
ICacheManager cacheManager, ICacheManager cacheManager,
Logger logger) Logger logger)
{ {
@ -39,6 +42,7 @@ namespace Radarr.Api.V3.Indexers
_downloadDecisionMaker = downloadDecisionMaker; _downloadDecisionMaker = downloadDecisionMaker;
_prioritizeDownloadDecision = prioritizeDownloadDecision; _prioritizeDownloadDecision = prioritizeDownloadDecision;
_downloadService = downloadService; _downloadService = downloadService;
_movieService = movieService;
_logger = logger; _logger = logger;
PostValidator.RuleFor(s => s.IndexerId).ValidId(); PostValidator.RuleFor(s => s.IndexerId).ValidId();
@ -63,6 +67,20 @@ namespace Radarr.Api.V3.Indexers
try 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); _downloadService.DownloadReport(remoteMovie);
} }
catch (ReleaseDownloadException ex) catch (ReleaseDownloadException ex)

Loading…
Cancel
Save