do not crash if there are no cache files to delete
java.lang.NullPointerException at org.fdroid.fdroid.Utils.clearOldFiles(Utils.java:347) at org.fdroid.fdroid.CleanCacheService.onHandleIntent(CleanCacheService.java:51) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:194) at android.os.HandlerThread.run(HandlerThread.java:60)
This commit is contained in:
parent
ae2def3e0d
commit
65cbc9dc10
@ -151,8 +151,12 @@ public class ApkCache {
|
||||
if (dir == null) {
|
||||
return;
|
||||
}
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
long olderThan = System.currentTimeMillis() - (secondsAgo * 1000L);
|
||||
for (File f : dir.listFiles()) {
|
||||
for (File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
clearOldFiles(f, olderThan);
|
||||
f.delete();
|
||||
|
Loading…
x
Reference in New Issue
Block a user