Skip to content

Commit 2e0e794

Browse files
author
Yang Guo
committed
fix null pointer exception on git commit
1 parent 9883b57 commit 2e0e794

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

platform-util-git/src/main/java/com/flow/platform/util/git/JGitBasedClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ public GitCommit commit(String refName) throws GitException {
209209
Repository repo = git.getRepository();
210210
Ref head = repo.findRef(refName);
211211

212+
if (head == null) {
213+
return null;
214+
}
215+
212216
try (RevWalk walk = new RevWalk(repo)) {
213217
RevCommit commit = walk.parseCommit(head.getObjectId());
214218
walk.dispose();

0 commit comments

Comments
 (0)