fix: remove null-check of sshKey in EditRemote

This commit is contained in:
Gadfly 2024-08-12 19:28:01 +08:00
parent 69178838be
commit 04c9214fc0
No known key found for this signature in database

View file

@ -93,11 +93,8 @@ namespace SourceGit.ViewModels
public static ValidationResult ValidateSSHKey(string sshkey, ValidationContext ctx)
{
if (ctx.ObjectInstance is EditRemote edit && edit.UseSSH)
if (ctx.ObjectInstance is EditRemote { _useSSH: true } && !string.IsNullOrEmpty(sshkey))
{
if (string.IsNullOrEmpty(sshkey))
return new ValidationResult("SSH private key is required");
if (!File.Exists(sshkey))
return new ValidationResult("Given SSH private key can NOT be found!");
}