Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Fix NPE if there are no parents for a commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneMcC committed May 1, 2016
1 parent 8b58a0c commit 48a054c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/org/mdonoughe/JGitDescribeTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ private static int distanceBetween (RevCommit child, RevCommit parent) {
Queue<RevCommit> pq = new LinkedList<RevCommit>();
pq.add(commit);
while (pq.size() > 0) {
for (RevCommit pp : pq.remove().getParents()) {
RevCommit rc = pq.remove();
if (rc == null || rc.getParents() == null) { continue; }
for (RevCommit pp : rc.getParents()) {
if (!seenb.contains(pp)) {
seenb.add(pp);
pq.add(pp);
Expand Down

0 comments on commit 48a054c

Please sign in to comment.