From 6214803a5a74dc62f071eeb10283abb625108b75 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 25 Apr 2026 04:48:10 +0300 Subject: [PATCH] Don't throw error on pushed releases with empty indexer or download client IDs --- src/NzbDrone.Core/Download/DownloadClientFactory.cs | 4 ++-- src/NzbDrone.Core/Indexers/IndexerFactory.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/Download/DownloadClientFactory.cs b/src/NzbDrone.Core/Download/DownloadClientFactory.cs index 1d98012c4..1906ffef3 100644 --- a/src/NzbDrone.Core/Download/DownloadClientFactory.cs +++ b/src/NzbDrone.Core/Download/DownloadClientFactory.cs @@ -60,9 +60,9 @@ public DownloadClientDefinition ResolveDownloadClient(int? id, string name) { var all = All(); var clientByName = name.IsNullOrWhiteSpace() ? null : all.FirstOrDefault(c => c.Name.EqualsIgnoreCase(name)); - var clientById = id.HasValue ? all.FirstOrDefault(c => c.Id == id.Value) : null; + var clientById = id is > 0 ? all.FirstOrDefault(c => c.Id == id.Value) : null; - if (id.HasValue && clientById == null) + if (id is > 0 && clientById == null) { throw new ResolveDownloadClientException("Download client with ID '{0}' could not be found", id.Value); } diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs index 6fca9e540..b22e1b669 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -96,9 +96,9 @@ public IndexerDefinition ResolveIndexer(int? id, string name) { var all = All(); var clientByName = name.IsNullOrWhiteSpace() ? null : all.FirstOrDefault(c => c.Name.EqualsIgnoreCase(name)); - var clientById = id.HasValue ? all.FirstOrDefault(c => c.Id == id.Value) : null; + var clientById = id is > 0 ? all.FirstOrDefault(c => c.Id == id.Value) : null; - if (id.HasValue && clientById == null) + if (id is > 0 && clientById == null) { throw new ResolveIndexerException("Indexer with ID '{0}' could not be found", id.Value); } @@ -115,7 +115,7 @@ public IndexerDefinition ResolveIndexer(int? id, string name) if (clientByName != null && clientById != null && clientByName.Id != clientById.Id) { - throw new ResolveIndexerException("Indexer with name '{0}' does not match Indexerwith ID '{1}'", name, id.Value); + throw new ResolveIndexerException("Indexer with name '{0}' does not match indexer with ID '{1}'", name, id.Value); } return clientById ?? clientByName;