From 0bfb557470dc92bbf9a02c0e8cd76bd104e27a4b Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 3 Aug 2023 17:55:50 -0700 Subject: [PATCH] Prevent NullRef in ContainsInvalidPathChars (cherry picked from commit 5f7217844533907d7fc6287a48efb31987736c4c) --- src/NzbDrone.Common/Extensions/PathExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/NzbDrone.Common/Extensions/PathExtensions.cs b/src/NzbDrone.Common/Extensions/PathExtensions.cs index f2d82f10e..b7af090bc 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -158,6 +158,11 @@ namespace NzbDrone.Common.Extensions public static bool ContainsInvalidPathChars(this string text) { + if (text.IsNullOrWhiteSpace()) + { + throw new ArgumentNullException("text"); + } + return text.IndexOfAny(Path.GetInvalidPathChars()) >= 0; }