summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java4
2 files changed, 11 insertions, 1 deletions
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();
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
index 21ce78e7e9..04a4b4c631 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
+++ b/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;
+ }
}
/**