Browse Source

Merge "ObjectWalk: Add null check before skip tree."

stable-5.8
Jonathan Nieder 5 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
fb45137a7c
  1. 8
      org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java
  2. 4
      org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java

8
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();
}
}

4
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java

@ -364,7 +364,9 @@ public class ObjectWalk extends RevWalk {
* @since 5.4
*/
public void skipTree() {
currVisit.ptr = currVisit.buf.length;
if (currVisit != null) {
currVisit.ptr = currVisit.buf.length;
}
}
/**

Loading…
Cancel
Save