From cf6018c64d01af1233eaf2d63f09d5ee403b3345 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Thu, 29 Jun 2017 20:39:17 +0300 Subject: [PATCH] [git] first commit can be empty when file history is empty EA-103921 --- plugins/git4idea/src/git4idea/history/GitFileHistory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/git4idea/src/git4idea/history/GitFileHistory.java b/plugins/git4idea/src/git4idea/history/GitFileHistory.java index 768d671b8be7..7da3401f8155 100644 --- a/plugins/git4idea/src/git4idea/history/GitFileHistory.java +++ b/plugins/git4idea/src/git4idea/history/GitFileHistory.java @@ -118,7 +118,9 @@ public class GitFileHistory { } try { - Pair firstCommitParentAndPath = getFirstCommitParentAndPathIfRename(recordConsumer.getFirstCommit(), currentPath); + String firstCommit = recordConsumer.getFirstCommit(); + if (firstCommit == null) return; + Pair firstCommitParentAndPath = getFirstCommitParentAndPathIfRename(firstCommit, currentPath); if (firstCommitParentAndPath == null) { return; } @@ -448,7 +450,7 @@ public class GitFileHistory { return myCurrentPath.get(); } - @NotNull + @Nullable public String getFirstCommit() { return myFirstCommit.get(); }