diff --git a/src/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs index e0bf2784d..b038cc01e 100644 --- a/src/NzbDrone.Core/Download/DownloadService.cs +++ b/src/NzbDrone.Core/Download/DownloadService.cs @@ -63,7 +63,6 @@ namespace NzbDrone.Core.Download // Get the seed configuration for this release. remoteAlbum.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteAlbum); - var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteAlbum.Release.IndexerId)); // Limit grabs to 2 per second. if (remoteAlbum.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteAlbum.Release.DownloadUrl.StartsWith("magnet:")) @@ -72,6 +71,13 @@ namespace NzbDrone.Core.Download _rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2)); } + IIndexer indexer = null; + + if (remoteAlbum.Release.IndexerId > 0) + { + indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteAlbum.Release.IndexerId)); + } + string downloadClientId; try { diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index 7761f5978..939aa7f04 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 = remoteAlbum?.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 7ee5ba009..1a304900f 100644 --- a/src/NzbDrone.Core/Download/UsenetClientBase.cs +++ b/src/NzbDrone.Core/Download/UsenetClientBase.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Download try { - var request = indexer.GetDownloadRequest(url); + var request = indexer?.GetDownloadRequest(url) ?? new HttpRequest(url); request.RateLimitKey = remoteAlbum?.Release?.IndexerId.ToString(); // TODO: Look into moving download request handling to indexer