From 7ba261fb5f516dce83adc6f3bd4ac1666a51193e Mon Sep 17 00:00:00 2001 From: Yunjie Li Date: Tue, 25 Feb 2020 17:29:38 -0800 Subject: ObjectWalk: Add null check before skip tree. currVisit could be null if a blob is marked as start point in ObjectWalk. Add null check before skipping current tree. Change-Id: Ic5d876fe2800f3373d136979be6c27d1bbd38dc1 Signed-off-by: Yunjie Li --- .../tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java index a3bfb71e40..da7b266125 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java @@ -216,4 +216,12 @@ public class ObjectWalkTest extends RevWalkTestCase { assertSame(rw.lookupBlob(bId), objw.nextObject()); assertNull(objw.nextObject()); } + + @Test + public void testSkipTreeWhenStartFromBlob() throws Exception { + final RevBlob f1 = blob("1"); + objw.markStart(f1); + assertSame(f1, objw.nextObject()); + objw.skipTree(); + } } -- cgit v1.2.3