Need to be more defensive about cache clearing with slow SD cards

This commit is contained in:
Ciaran Gultnieks 2013-08-09 12:18:22 +01:00
parent ce9fa45034
commit 2ad2b86e88

View File

@ -50,10 +50,10 @@ public class FDroidApp extends Application {
if (!prefs.getBoolean("cacheDownloaded", false)) {
File local_path = DB.getDataPath(this);
File[] files = local_path.listFiles();
// files can be null if the SD card is not ready - we'll just
// Things can be null if the SD card is not ready - we'll just
// ignore that and do it next time.
if(local_path != null) {
File[] files = local_path.listFiles();
if(files != null) {
for(File f : files) {
if(f.getName().endsWith(".apk")) {
@ -62,6 +62,7 @@ public class FDroidApp extends Application {
}
}
}
}
apps = null;
invalidApps = new ArrayList<String>();