Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86da47e8 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Fix possible NPE in FileUtils.

Change-Id: I503f91e266c71e2370a5807d171e2254c334f7cb
parent 6bca9ac4
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -25,10 +25,13 @@ import java.io.FilenameFilter;
public class FileUtils {
    public static boolean deleteRecursively(final File path) {
        if (path.isDirectory()) {
            for (final File child : path.listFiles()) {
            final File[] files = path.listFiles();
            if (files != null) {
                for (final File child : files) {
                    deleteRecursively(child);
                }
            }
        }
        return path.delete();
    }

@@ -37,6 +40,9 @@ public class FileUtils {
            return false;
        }
        final File[] files = dir.listFiles(fileNameFilter);
        if (files == null) {
            return false;
        }
        boolean hasDeletedAllFiles = true;
        for (final File file : files) {
            if (!deleteRecursively(file)) {