diff --git a/src/main/java/pl/project13/maven/git/JGitProvider.java b/src/main/java/pl/project13/maven/git/JGitProvider.java index 9778217d..2e661ab3 100644 --- a/src/main/java/pl/project13/maven/git/JGitProvider.java +++ b/src/main/java/pl/project13/maven/git/JGitProvider.java @@ -83,12 +83,16 @@ protected String getBuildAuthorEmail() { protected void prepareGitToExtractMoreDetailedReproInformation() throws MojoExecutionException { try { // more details parsed out bellow - Ref HEAD = git.getRef(Constants.HEAD); - if (HEAD == null) { - throw new MojoExecutionException("Could not get HEAD Ref, are you sure you've set the dotGitDirectory property of this plugin to a valid path?"); + Ref head = git.getRef(Constants.HEAD); + if (head == null) { + throw new MojoExecutionException("Could not get HEAD Ref, are you sure you have set the dotGitDirectory property of this plugin to a valid path?"); } revWalk = new RevWalk(git); - headCommit = revWalk.parseCommit(HEAD.getObjectId()); + ObjectId headObjectId = head.getObjectId(); + if(headObjectId == null){ + throw new MojoExecutionException("Could not get HEAD Ref, are you sure you have some commits in the dotGitDirectory?"); + } + headCommit = revWalk.parseCommit(headObjectId); revWalk.markStart(headCommit); } catch (MojoExecutionException e) { throw e;