fixed rare npe when doing file migration
This commit is contained in:
parent
6fc67d9a60
commit
d7198bd68c
|
@ -411,7 +411,11 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
if (oldFilesDirectory.exists() && oldFilesDirectory.isDirectory()) {
|
if (oldFilesDirectory.exists() && oldFilesDirectory.isDirectory()) {
|
||||||
newFilesDirectory.mkdirs();
|
newFilesDirectory.mkdirs();
|
||||||
newVideosDirectory.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.getName().equals(".nomedia")) {
|
||||||
if (file.delete()) {
|
if (file.delete()) {
|
||||||
Log.d(Config.LOGTAG,"deleted nomedia file in "+oldFilesDirectory.getAbsolutePath());
|
Log.d(Config.LOGTAG,"deleted nomedia file in "+oldFilesDirectory.getAbsolutePath());
|
||||||
|
|
Loading…
Reference in New Issue