From 8350120673a1636f573e8347f98a6a9020dd804f Mon Sep 17 00:00:00 2001 From: nitrobass24 Date: Wed, 15 Apr 2026 00:30:22 -0500 Subject: [PATCH] Guard GetIndexer against null mapping and complete Equals comparison Avoid calling GetIndexer with ID 0 when no mapping exists. Add Capabilities, TimeoutSeconds, LimitDefault, and LimitMax to the Equals check so changes to those fields trigger sync updates. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/NzbDrone.Core/Applications/Qui/Qui.cs | 4 +++- src/NzbDrone.Core/Applications/Qui/QuiIndexer.cs | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Applications/Qui/Qui.cs b/src/NzbDrone.Core/Applications/Qui/Qui.cs index 950356fbd..dcdc7f852 100644 --- a/src/NzbDrone.Core/Applications/Qui/Qui.cs +++ b/src/NzbDrone.Core/Applications/Qui/Qui.cs @@ -114,7 +114,9 @@ public override void UpdateIndexer(IndexerDefinition indexer, bool forceSync = f var quiIndexer = BuildQuiIndexer(indexer, indexerCapabilities, indexerMapping?.RemoteIndexerId ?? 0); - var remoteIndexer = _quiProxy.GetIndexer(indexerMapping?.RemoteIndexerId ?? 0, Settings); + var remoteIndexer = indexerMapping?.RemoteIndexerId > 0 + ? _quiProxy.GetIndexer(indexerMapping.RemoteIndexerId, Settings) + : null; if (remoteIndexer != null) { diff --git a/src/NzbDrone.Core/Applications/Qui/QuiIndexer.cs b/src/NzbDrone.Core/Applications/Qui/QuiIndexer.cs index 9ace70b06..3834d5da4 100644 --- a/src/NzbDrone.Core/Applications/Qui/QuiIndexer.cs +++ b/src/NzbDrone.Core/Applications/Qui/QuiIndexer.cs @@ -71,13 +71,20 @@ public bool Equals(QuiIndexer other) var thisCategories = (Categories ?? Enumerable.Empty()).Select(c => c.CategoryId).OrderBy(c => c); var otherCategories = (other.Categories ?? Enumerable.Empty()).Select(c => c.CategoryId).OrderBy(c => c); + var thisCapabilities = (Capabilities ?? Enumerable.Empty()).OrderBy(c => c); + var otherCapabilities = (other.Capabilities ?? Enumerable.Empty()).OrderBy(c => c); + return other.BaseUrl == BaseUrl && other.ApiKey == ApiKey && other.Name == Name && other.Backend == Backend && other.Enabled == Enabled && other.Priority == Priority && + other.TimeoutSeconds == TimeoutSeconds && + other.LimitDefault == LimitDefault && + other.LimitMax == LimitMax && other.IndexerId == IndexerId && + otherCapabilities.SequenceEqual(thisCapabilities) && otherCategories.SequenceEqual(thisCategories); }