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 <yunjieli@google.com>
This commit is contained in:
parent
f63583928f
commit
7ba261fb5f
|
@ -216,4 +216,12 @@ public void testEmptyTreeCorruption() throws Exception {
|
||||||
assertSame(rw.lookupBlob(bId), objw.nextObject());
|
assertSame(rw.lookupBlob(bId), objw.nextObject());
|
||||||
assertNull(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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,9 @@ public RevCommit next() throws MissingObjectException,
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public void skipTree() {
|
public void skipTree() {
|
||||||
currVisit.ptr = currVisit.buf.length;
|
if (currVisit != null) {
|
||||||
|
currVisit.ptr = currVisit.buf.length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue