Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
index 83181eea23..2a2a6ba1bc 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
@@ -1295,9 +1295,15 @@ public class CommitOnlyTest extends RepositoryTestCase {
try {
final Repository repo = git.getRepository();
final ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}");
+ if (headId == null) {
+ return "";
+ }
try (RevWalk rw = new RevWalk(repo)) {
final TreeWalk tw = TreeWalk.forPath(repo, path,
rw.parseTree(headId));
+ if (tw == null) {
+ return "";
+ }
return new String(tw.getObjectReader().open(tw.getObjectId(0))
.getBytes(), UTF_8);
}

Back to the top