Skip to content

Commit

Permalink
[FIXED JENKINS-10880] check for existing lastBuild
Browse files Browse the repository at this point in the history
Fix the NPE when there was no lastBuild available with
fast remote polling enabled
  • Loading branch information
marc-guenther committed Jun 25, 2012
1 parent 987a44a commit 91cc5c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -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) {
Expand Down

1 comment on commit 91cc5c9

@buildhive
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.