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

This commit is contained in:
Jonathan Nieder 2020-03-02 13:37:59 -05:00 committed by Gerrit Code Review @ Eclipse.org
commit fb45137a7c
2 changed files with 11 additions and 1 deletions

View File

@ -216,4 +216,12 @@ public void testEmptyTreeCorruption() throws Exception {
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();
}
}

View File

@ -364,7 +364,9 @@ public RevCommit next() throws MissingObjectException,
* @since 5.4
*/
public void skipTree() {
currVisit.ptr = currVisit.buf.length;
if (currVisit != null) {
currVisit.ptr = currVisit.buf.length;
}
}
/**