Skip to content
Permalink
Browse files
[JENKINS-34369] protect against a NPE form GitSCM.getBuildData is not…
… checked into PreBuildMerge.decorateRevisionToBuild
  • Loading branch information
kuisathaverat committed Apr 21, 2016
1 parent b622397 commit 11f792c756a6f030355df73932ccde99a9057146
Showing 1 changed file with 5 additions and 1 deletion.
@@ -11,6 +11,7 @@
import hudson.plugins.git.extensions.GitSCMExtension;
import hudson.plugins.git.extensions.GitSCMExtensionDescriptor;
import hudson.plugins.git.util.Build;
import hudson.plugins.git.util.BuildData;
import hudson.plugins.git.util.GitUtils;
import hudson.plugins.git.util.MergeRecord;
import org.eclipse.jgit.lib.ObjectId;
@@ -85,7 +86,10 @@ public Revision decorateRevisionToBuild(GitSCM scm, Run<?, ?> build, GitClient g
// record the fact that we've tried building 'rev' and it failed, or else
// BuildChooser in future builds will pick up this same 'rev' again and we'll see the exact same merge failure
// all over again.
scm.getBuildData(build).saveBuild(new Build(marked,rev, build.getNumber(), FAILURE));
BuildData bd = scm.getBuildData(build);
if(bd != null){
bd.saveBuild(new Build(marked,rev, build.getNumber(), FAILURE));
}
throw new AbortException("Branch not suitable for integration as it does not merge cleanly: " + ex.getMessage());
}

0 comments on commit 11f792c

Please sign in to comment.