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>
This commit is contained in:
parent
27c1c51079
commit
781b0b5735
|
@ -475,7 +475,7 @@ private static boolean isSamePrefix(String a, String b) {
|
||||||
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…
Reference in New Issue