From 5b4f54a959bc230985145ed2ca7b5a4ff2784459 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 5 Oct 2023 02:42:18 +0300 Subject: [PATCH] Prevent NullRef for cases when media covers have nullable urls (cherry picked from commit a26df9e9afa8d925c2ad62c126d4edebec7e4e54) Closes #2981 --- src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs b/src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs index a82c7224d..235d5eafe 100644 --- a/src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs +++ b/src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using NzbDrone.Common.Cache; +using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; @@ -30,6 +31,11 @@ public MediaCoverProxy(IHttpClient httpClient, IConfigFileProvider configFilePro public string RegisterUrl(string url) { + if (url.IsNullOrWhiteSpace()) + { + return null; + } + var hash = url.SHA256Hash(); _cache.Set(hash, url, TimeSpan.FromHours(24));