Skip to content

Commit

Permalink
[JENKINS-63572] Avoid NPE if remote configs is empty
Browse files Browse the repository at this point in the history
If a pipeline job defines the checkout scm step without including a
remote repository, the job will usually fail in other ways.

A null pointer exception is not a friendly way to show a configuration
error to a user.
  • Loading branch information
MarkEWaite committed Sep 12, 2020
1 parent e71936e commit be5485d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/hudson/plugins/git/GitSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,13 @@ public GitClient createClient(TaskListener listener, EnvVars environment, Run<?,
String url = getParameterString(uc.getUrl(), environment);
chooser = new GitToolChooser(url, project, ucCredentialsId, gitTool, n, listener,unsupportedCommand.determineSupportForJGit());
}
listener.getLogger().println("The recommended git tool is: " + chooser.getGitTool());
String updatedGitExe = chooser.getGitTool();

if (!updatedGitExe.equals("NONE")) {
gitExe = updatedGitExe;
if (chooser != null) {
listener.getLogger().println("The recommended git tool is: " + chooser.getGitTool());
String updatedGitExe = chooser.getGitTool();

if (!updatedGitExe.equals("NONE")) {
gitExe = updatedGitExe;
}
}
}
Git git = Git.with(listener, environment).in(ws).using(gitExe);
Expand Down

0 comments on commit be5485d

Please sign in to comment.