Skip to content

Commit

Permalink
[JENKINS-46172] Prevent NPE when binding incomplete definitions of ss…
Browse files Browse the repository at this point in the history
…h host

Proper ssh host should have at least:
1. hostname not empty
2. attached credentials
  • Loading branch information
ljader committed Mar 25, 2018
1 parent 52bd63a commit d18d0ed
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -70,7 +70,9 @@ private CredentialsSSHSite() {
public CredentialsSSHSite(final String hostname, final String port, final String credentialId,
final String serverAliveInterval, final String timeout) {
final StandardUsernameCredentials credentials = lookupCredentialsById(credentialId);
this.username = credentials.getUsername();
if (credentials != null) {
this.username = credentials.getUsername();
}

this.hostname = hostname;
try {
Expand Down

0 comments on commit d18d0ed

Please sign in to comment.