Skip to content

Commit 7aaef82

Browse files
Fearxpciusarnve
andauthored
old buildata hash can be null - fix NPE (jenkinsci#1152)
Co-authored-by: iusarnve <iusarnve@mail.gitlabdemo.cloud>
1 parent 03a49b8 commit 7aaef82

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/dabsquared/gitlabjenkins/util/CommitStatusUpdater.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ private static List<GitLabBranchBuild> retrieveGitlabProjectIds(Run<?, ?> build,
191191

192192
for (final BuildData buildData : buildDatas) {
193193
for (final Entry<String, Build> buildByBranchName : buildData.getBuildsByBranchName().entrySet()) {
194-
if (buildByBranchName.getValue().getSHA1().equals(ObjectId.fromString(scmRevisionHash))) {
195-
addGitLabBranchBuild(result, scmRevisionHash, buildData.getRemoteUrls(), environment, gitLabClient);
194+
if (buildByBranchName.getValue().getSHA1() != null){
195+
if (buildByBranchName.getValue().getSHA1().equals(ObjectId.fromString(scmRevisionHash))) {
196+
addGitLabBranchBuild(result, scmRevisionHash, buildData.getRemoteUrls(), environment, gitLabClient);
197+
}
196198
}
197199
}
198200
}

0 commit comments

Comments
 (0)