From 6f61c79e8b7bc1e1ac2e76cb9c68cf724f53de3b Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 12 Aug 2021 11:27:36 +0800 Subject: [PATCH] fix: fix crash reported by https://gitee.com/sourcegit/sourcegit/issues/I452PA --- src/Views/Validations/BranchName.cs | 2 +- src/Views/Validations/TagName.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/Validations/BranchName.cs b/src/Views/Validations/BranchName.cs index 472c2aad..6de649ca 100644 --- a/src/Views/Validations/BranchName.cs +++ b/src/Views/Validations/BranchName.cs @@ -11,7 +11,7 @@ namespace SourceGit.Views.Validations { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { var name = value as string; - if (string.IsNullOrEmpty(name)) new ValidationResult(false, App.Text("EmptyBranchName")); + if (string.IsNullOrEmpty(name)) return new ValidationResult(false, App.Text("EmptyBranchName")); if (!REG_FORMAT.IsMatch(name)) return new ValidationResult(false, App.Text("BadBranchName")); name = Prefix + name; diff --git a/src/Views/Validations/TagName.cs b/src/Views/Validations/TagName.cs index 20755a2a..570fe737 100644 --- a/src/Views/Validations/TagName.cs +++ b/src/Views/Validations/TagName.cs @@ -11,7 +11,7 @@ namespace SourceGit.Views.Validations { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { var name = value as string; - if (string.IsNullOrEmpty(name)) new ValidationResult(false, App.Text("EmptyTagName")); + if (string.IsNullOrEmpty(name)) return new ValidationResult(false, App.Text("EmptyTagName")); if (!REG_FORMAT.IsMatch(name)) return new ValidationResult(false, App.Text("BadTagName")); foreach (var t in Tags) {