aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroshi Tomita <tomykaira@gmail.com>2013-07-05 09:04:00 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2013-08-21 14:44:47 +0200
commit781b0b5735f8be2db2a2d4072a17ed7fdeeab36e (patch)
tree578f374b4f83e22f10a65e013baac6d79c387f39
parent27c1c51079e1bd36c82203a6f89d1daa6cbef848 (diff)
downloadjgit-781b0b5735f8be2db2a2d4072a17ed7fdeeab36e.tar.gz
jgit-781b0b5735f8be2db2a2d4072a17ed7fdeeab36e.zip
Check parentFile is not null
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 6fb56ed1b7..684cf21ae8 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();