Need to be more defensive about cache clearing with slow SD cards
This commit is contained in:
parent
ce9fa45034
commit
2ad2b86e88
@ -50,14 +50,15 @@ public class FDroidApp extends Application {
|
|||||||
if (!prefs.getBoolean("cacheDownloaded", false)) {
|
if (!prefs.getBoolean("cacheDownloaded", false)) {
|
||||||
|
|
||||||
File local_path = DB.getDataPath(this);
|
File local_path = DB.getDataPath(this);
|
||||||
|
// Things can be null if the SD card is not ready - we'll just
|
||||||
File[] files = local_path.listFiles();
|
|
||||||
// files can be null if the SD card is not ready - we'll just
|
|
||||||
// ignore that and do it next time.
|
// ignore that and do it next time.
|
||||||
if(files != null) {
|
if(local_path != null) {
|
||||||
for(File f : files) {
|
File[] files = local_path.listFiles();
|
||||||
if(f.getName().endsWith(".apk")) {
|
if(files != null) {
|
||||||
f.delete();
|
for(File f : files) {
|
||||||
|
if(f.getName().endsWith(".apk")) {
|
||||||
|
f.delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user