From eca1d69ed2e91837635c1481dc555d1ee6337a51 Mon Sep 17 00:00:00 2001 From: Braydon Date: Sun, 6 Aug 2023 00:20:12 -0400 Subject: [PATCH] only parse parent commit if present --- src/main/java/me/braydon/plugin/GitUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/braydon/plugin/GitUtils.java b/src/main/java/me/braydon/plugin/GitUtils.java index add1ff6..336cc9f 100644 --- a/src/main/java/me/braydon/plugin/GitUtils.java +++ b/src/main/java/me/braydon/plugin/GitUtils.java @@ -70,7 +70,9 @@ public final class GitUtils { return new AbstractMap.SimpleEntry<>(latestCommit.getName(), commitsSinceLastTag); } commitsSinceLastTag++; // Increment commits since last tag - commit = walk.parseCommit(commit.getParent(0)); // Get the parent commit + if (commit.getParentCount() > 0) { // Get the parent commit + commit = walk.parseCommit(commit.getParent(0)); + } } } catch (IOException | GitAPIException ex) { System.err.println("Failed fetching git data:");