Commit 6234106d authored by Gang Wu's avatar Gang Wu Committed by Commit Bot

Add null check before for loop using the list

The bug was introduced by https://chromium-review.googlesource.com/c/chromium/src/+/2032427
and code was moved to here by https://chromium-review.googlesource.com/c/chromium/src/+/2063037

Bug: 1053790
Change-Id: I683351902f635ba329c14ccaec87540c36758cdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2075418Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Commit-Queue: Gang Wu <gangwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745076}
parent 864dcb75
...@@ -64,10 +64,13 @@ public class ShareImageFileUtils { ...@@ -64,10 +64,13 @@ public class ShareImageFileUtils {
boolean anyChildKept = false; boolean anyChildKept = false;
if (file.isDirectory()) { if (file.isDirectory()) {
File[] file_list = file.listFiles();
if (file_list != null) {
for (File child : file.listFiles()) { for (File child : file.listFiles()) {
anyChildKept |= deleteFiles(child, reservedFilepath); anyChildKept |= deleteFiles(child, reservedFilepath);
} }
} }
}
// file.delete() will fail if |file| is a directory and has a file need to keep. In this // file.delete() will fail if |file| is a directory and has a file need to keep. In this
// case, the log should not been recorded since it is correct. // case, the log should not been recorded since it is correct.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment