diff options
author | Hiroshi Tomita <tomykaira@gmail.com> | 2013-07-05 09:04:00 +0900 |
---|---|---|
committer | Hiroshi Tomita <tomykaira@gmail.com> | 2013-07-05 09:09:04 +0900 |
commit | 8e307cde562250c49479a930f453f08e28cf051b (patch) | |
tree | 924850ae77ef25f0576d030484422c405c09d7fe | |
parent | 21b3a16ab7692230ca7e435f99f0623e21aa353c (diff) | |
download | jgit-8e307cde562250c49479a930f453f08e28cf051b.tar.gz jgit-8e307cde562250c49479a930f453f08e28cf051b.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.java | 2 |
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(); |