diff --git a/src/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs index 96a8a8730..c867d3396 100644 --- a/src/NzbDrone.Core/Download/DownloadService.cs +++ b/src/NzbDrone.Core/Download/DownloadService.cs @@ -71,7 +71,6 @@ namespace NzbDrone.Core.Download // Get the seed configuration for this release. remoteEpisode.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteEpisode); - var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteEpisode.Release.IndexerId)); // Limit grabs to 2 per second. if (remoteEpisode.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteEpisode.Release.DownloadUrl.StartsWith("magnet:")) @@ -80,6 +79,13 @@ namespace NzbDrone.Core.Download _rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2)); } + IIndexer indexer = null; + + if (remoteEpisode.Release.IndexerId > 0) + { + indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteEpisode.Release.IndexerId)); + } + string downloadClientId; try { diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index a54294ab7..9dc903a25 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -127,7 +127,7 @@ namespace NzbDrone.Core.Download try { - var request = indexer.GetDownloadRequest(torrentUrl); + var request = indexer?.GetDownloadRequest(torrentUrl) ?? new HttpRequest(torrentUrl); request.RateLimitKey = remoteEpisode?.Release?.IndexerId.ToString(); request.Headers.Accept = "application/x-bittorrent"; request.AllowAutoRedirect = false; diff --git a/src/NzbDrone.Core/Download/UsenetClientBase.cs b/src/NzbDrone.Core/Download/UsenetClientBase.cs index 5e427bcd6..8bd815201 100644 --- a/src/NzbDrone.Core/Download/UsenetClientBase.cs +++ b/src/NzbDrone.Core/Download/UsenetClientBase.cs @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Download try { - var request = indexer.GetDownloadRequest(url); + var request = indexer?.GetDownloadRequest(url) ?? new HttpRequest(url); request.RateLimitKey = remoteEpisode?.Release?.IndexerId.ToString(); nzbData = _httpClient.Get(request).ResponseData;