From 42a0fe343b236dde86ffbfaa8a7f27a0d60050f5 Mon Sep 17 00:00:00 2001 From: Robin Smith Date: Thu, 25 Feb 2021 13:35:08 +0000 Subject: [PATCH] Prevent NPE if Windows agent private key credential ID is not set --- .../plugins/computeengine/ComputeEngineWindowsLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineWindowsLauncher.java b/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineWindowsLauncher.java index 6862067f..cd59e478 100644 --- a/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineWindowsLauncher.java +++ b/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineWindowsLauncher.java @@ -69,7 +69,7 @@ public static boolean authenticateSSH( TaskListener listener) throws Exception { boolean isAuthenticated; - if (!windowsConfig.getPrivateKeyCredentialsId().isEmpty()) { + if (windowsConfig.getPrivateKeyCredentialsId() && !windowsConfig.getPrivateKeyCredentialsId().isEmpty()) { isAuthenticated = SSHAuthenticator.newInstance( sshConnection, windowsConfig.getPrivateKeyCredentials(), windowsUsername)