Browse Source

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>
stable-3.0
Hiroshi Tomita 12 years ago committed by Matthias Sohn
parent
commit
781b0b5735
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java

2
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java vendored

@ -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();

Loading…
Cancel
Save