fixed rare npe when doing file migration

This commit is contained in:
Daniel Gultsch 2017-02-07 10:20:13 +01:00
parent 6fc67d9a60
commit d7198bd68c

View file

@ -411,7 +411,11 @@ public class DatabaseBackend extends SQLiteOpenHelper {
if (oldFilesDirectory.exists() && oldFilesDirectory.isDirectory()) {
newFilesDirectory.mkdirs();
newVideosDirectory.mkdirs();
for(File file : oldFilesDirectory.listFiles()) {
final File[] files = oldFilesDirectory.listFiles();
if (files == null) {
return;
}
for(File file : files) {
if (file.getName().equals(".nomedia")) {
if (file.delete()) {
Log.d(Config.LOGTAG,"deleted nomedia file in "+oldFilesDirectory.getAbsolutePath());