From 8e307cde562250c49479a930f453f08e28cf051b Mon Sep 17 00:00:00 2001 From: Hiroshi Tomita Date: Fri, 5 Jul 2013 09:04:00 +0900 Subject: 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 --- org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); -- cgit v1.2.3