From daabc6364dcfa024509256c609b8f3b51cfffa2a Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 31 Aug 2013 13:46:59 -0700 Subject: [PATCH] handling of blank paths during validation. --- NzbDrone.Api/Validation/PathValidator.cs | 1 + NzbDrone.Common/PathExtensions.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Api/Validation/PathValidator.cs b/NzbDrone.Api/Validation/PathValidator.cs index bc055a98c..f7cf37eab 100644 --- a/NzbDrone.Api/Validation/PathValidator.cs +++ b/NzbDrone.Api/Validation/PathValidator.cs @@ -12,6 +12,7 @@ public PathValidator() protected override bool IsValid(PropertyValidatorContext context) { + if (context.PropertyValue == null) return false; return context.PropertyValue.ToString().IsPathValid(); } } diff --git a/NzbDrone.Common/PathExtensions.cs b/NzbDrone.Common/PathExtensions.cs index 68938c55a..15687895f 100644 --- a/NzbDrone.Common/PathExtensions.cs +++ b/NzbDrone.Common/PathExtensions.cs @@ -50,7 +50,7 @@ public static bool PathEquals(this string firstPath, string secondPath) public static bool IsPathValid(this string path) { - if (path.ContainsInvalidPathChars()) + if (path.ContainsInvalidPathChars() || string.IsNullOrWhiteSpace(path)) { return false; }