Skip to content
Permalink
Browse files

[FIXED JENKINS-10880] check for existing lastBuild

Fix the NPE when there was no lastBuild available with
fast remote polling enabled
  • Loading branch information
marc-guenther committed Apr 10, 2012
1 parent 987a44a commit 91cc5c968070ffd6bb47568b5aa3d2da4859938b
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/main/java/hudson/plugins/git/GitSCM.java
@@ -662,13 +662,14 @@ protected PollingResult compareRemoteRevisionWith(AbstractProject<?, ?> project,

final BuildData buildData = fixNull(getBuildData(lastBuild, false));

if (buildData != null && buildData.lastBuild != null) {
if (buildData.lastBuild != null) {
listener.getLogger().println("[poll] Last Built Revision: " + buildData.lastBuild.revision);
}

final String singleBranch = getSingleBranch(lastBuild);

if (singleBranch != null && this.remotePoll) {
// fast remote polling needs a single branch and an existing last build
if (this.remotePoll && singleBranch != null && buildData.lastBuild != null && buildData.lastBuild.getRevision() != null) {
String gitExe = "";
GitTool[] installations = ((hudson.plugins.git.GitTool.DescriptorImpl)Hudson.getInstance().getDescriptorByType(GitTool.DescriptorImpl.class)).getInstallations();
for(GitTool i : installations) {

1 comment on commit 91cc5c9

@buildhive

This comment has been minimized.

Copy link

buildhive commented on 91cc5c9 Jun 26, 2012

Jenkins » git-plugin #31 UNSTABLE
Looks like this commit caused a build failure
(what's this?)

Please sign in to comment.
You can’t perform that action at this time.