Skip to content

Commit 2bf77a4

Browse files
author
Robin Smith
committed
Prevent NPE if Windows agent private key credential ID is not set
1 parent 9efad89 commit 2bf77a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineWindowsLauncher.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public static boolean authenticateSSH(
6969
TaskListener listener)
7070
throws Exception {
7171
boolean isAuthenticated;
72-
if (!windowsConfig.getPrivateKeyCredentialsId().isEmpty()) {
72+
if (windowsConfig.getPrivateKeyCredentialsId() != null
73+
&& !windowsConfig.getPrivateKeyCredentialsId().isEmpty()) {
7374
isAuthenticated =
7475
SSHAuthenticator.newInstance(
7576
sshConnection, windowsConfig.getPrivateKeyCredentials(), windowsUsername)

0 commit comments

Comments
 (0)