Skip to content

Commit

Permalink
Merge pull request #182 from TheSnoozer/master
Browse files Browse the repository at this point in the history
Avoid NPE as discussed in #57
  • Loading branch information
TheSnoozer committed Apr 9, 2015
2 parents 4e28dbf + 3139543 commit bf4adb6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/pl/project13/maven/git/JGitProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bf4adb6

Please sign in to comment.