Skip to content

Commit 74a261f

Browse files
authored
scmRevisionHash might be null, prevent a NPE when calling 'ObjectId.fromString(scmRevisionHash)' (jenkinsci#1146)
1 parent 7aaef82 commit 74a261f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ private static List<GitLabBranchBuild> retrieveGitlabProjectIds(Run<?, ?> build,
188188
return result;
189189
}
190190
scmRevisionHash = ((AbstractGitSCMSource.SCMRevisionImpl) scmRevision).getHash();
191+
if (scmRevisionHash == null) {
192+
LOGGER.log(Level.INFO, "Build does not contain SCM revision hash.");
193+
return result;
194+
}
191195

192196
for (final BuildData buildData : buildDatas) {
193197
for (final Entry<String, Build> buildByBranchName : buildData.getBuildsByBranchName().entrySet()) {

0 commit comments

Comments
 (0)