From bd3816dac9b540d2f95960a254bb21ab3c91421e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 20 Feb 2023 17:20:07 -0800 Subject: [PATCH] Handle null for parent name with clean path is empty --- 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 bf105d1ec..6dab5e3a9 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -100,6 +100,11 @@ public static string GetParentName(this string childPath) { var cleanPath = childPath.GetCleanPath(); + if (cleanPath.IsNullOrWhiteSpace()) + { + return null; + } + return Directory.GetParent(cleanPath)?.Name; }