summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHiroshi Tomita2013-07-04 20:04:00 (EDT)
committer Matthias Sohn2013-08-21 08:44:47 (EDT)
commit781b0b5735f8be2db2a2d4072a17ed7fdeeab36e (patch)
tree578f374b4f83e22f10a65e013baac6d79c387f39
parent27c1c51079e1bd36c82203a6f89d1daa6cbef848 (diff)
downloadjgit-781b0b5735f8be2db2a2d4072a17ed7fdeeab36e.zip
jgit-781b0b5735f8be2db2a2d4072a17ed7fdeeab36e.tar.gz
jgit-781b0b5735f8be2db2a2d4072a17ed7fdeeab36e.tar.bz2
Check parentFile is not nullrefs/changes/06/15706/1
parentFile becomes null when f is relative path, such as ".". This patch avoids NullPointerException in such case. Change-Id: I4752674b1daab6eedd7c3650c7749462810eaffd Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index 6fb56ed..684cf21 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -475,7 +475,7 @@ public class DirCacheCheckout {
private void removeEmptyParents(File f) {
File parentFile = f.getParentFile();
- while (!parentFile.equals(repo.getWorkTree())) {
+ while (parentFile != null && !parentFile.equals(repo.getWorkTree())) {
if (!parentFile.delete())
break;
parentFile = parentFile.getParentFile();