mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 14:38:33 +00:00
Fix NPE in BackupUtil.
This commit is contained in:
parent
d40783f794
commit
0bf0eba450
@ -216,7 +216,13 @@ public class BackupUtil {
|
|||||||
if (Permissions.hasAll(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
if (Permissions.hasAll(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||||
try {
|
try {
|
||||||
File directory = StorageUtil.getBackupDirectory();
|
File directory = StorageUtil.getBackupDirectory();
|
||||||
return directory.exists() && directory.isDirectory() && directory.listFiles().length > 0;
|
|
||||||
|
if (directory.exists() && directory.isDirectory()) {
|
||||||
|
File[] files = directory.listFiles();
|
||||||
|
return files != null && files.length > 0;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} catch (NoExternalStorageException e) {
|
} catch (NoExternalStorageException e) {
|
||||||
Log.w(TAG, "Failed to read storage!", e);
|
Log.w(TAG, "Failed to read storage!", e);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user