diff --git a/src/Helpers/Validations.cs b/src/Helpers/Validations.cs index 3fb2deb2..5a1b7d36 100644 --- a/src/Helpers/Validations.cs +++ b/src/Helpers/Validations.cs @@ -130,9 +130,11 @@ namespace SourceGit.Helpers { /// public class SubmodulePathRequiredRule : ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { - var regex = new Regex(@"^[\w\-\._/]+$"); var path = value as string; - var succ = !string.IsNullOrEmpty(path) && regex.IsMatch(path.Trim()); + if (string.IsNullOrEmpty(path)) return ValidationResult.ValidResult; + + var regex = new Regex(@"^[\w\-\._/]+$"); + var succ = regex.IsMatch(path.Trim()); return !succ ? new ValidationResult(false, App.Text("BadSubmodulePath")) : ValidationResult.ValidResult; } }