Fix NPE on ShutdownCheckPoints

Fix list files to handle null File array while filtering for existing checkpoint dump files for cleanup.

Change-Id: I275d9a87996425392feb42362c967eb1cdcba80b
Fix: 256460338
Test: ShutdownCheckPointsTest
This commit is contained in:
Lais Andrade
2023-01-03 11:19:54 +00:00
parent 03882bc8bd
commit 012494405a

View File

@@ -54,6 +54,7 @@ public final class ShutdownCheckPoints {
private static final int MAX_DUMP_FILES = 20;
private static final SimpleDateFormat DATE_FORMAT =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z");
private static final File[] EMPTY_FILE_ARRAY = {};
private final ArrayList<CheckPoint> mCheckPoints;
private final Injector mInjector;
@@ -381,6 +382,9 @@ public final class ShutdownCheckPoints {
return true;
}
});
if (files == null) {
return EMPTY_FILE_ARRAY;
}
Arrays.sort(files);
return files;
}