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.1
Hiroshi Tomita 12 years ago
parent
commit
8e307cde56
  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) { private void removeEmptyParents(File f) {
File parentFile = f.getParentFile(); File parentFile = f.getParentFile();
while (!parentFile.equals(repo.getWorkTree())) { while (parentFile != null && !parentFile.equals(repo.getWorkTree())) {
if (!parentFile.delete()) if (!parentFile.delete())
break; break;
parentFile = parentFile.getParentFile(); parentFile = parentFile.getParentFile();

Loading…
Cancel
Save