From 7e218a886d2df446633584e3afbf259fc1c9a1be 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 (cherry picked from commit bd3816dac9b540d2f95960a254bb21ab3c91421e) --- 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 9d0025a44..8f4c0b22d 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -101,6 +101,11 @@ public static string GetParentName(this string childPath) { var cleanPath = childPath.GetCleanPath(); + if (cleanPath.IsNullOrWhiteSpace()) + { + return null; + } + return Directory.GetParent(cleanPath)?.Name; }