diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java index 98c34d1d5..27aac3edd 100644 --- a/src/org/fdroid/fdroid/FDroidApp.java +++ b/src/org/fdroid/fdroid/FDroidApp.java @@ -50,14 +50,15 @@ 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(files != null) { - for(File f : files) { - if(f.getName().endsWith(".apk")) { - f.delete(); + if(local_path != null) { + File[] files = local_path.listFiles(); + if(files != null) { + for(File f : files) { + if(f.getName().endsWith(".apk")) { + f.delete(); + } } } }