show only media folders that exist

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2019-02-07 16:56:52 +01:00
parent 43323e1669
commit 750bfbc3c4
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -118,8 +118,8 @@ public final class MediaProvider {
filePath = cursorImages.getString(cursorImages.getColumnIndexOrThrow(
MediaStore.MediaColumns.DATA));
// check if valid path
if (filePath != null && filePath.lastIndexOf('/') > 0) {
// check if valid path and file exists
if (filePath != null && filePath.lastIndexOf('/') > 0 && new File(filePath).exists()) {
mediaFolder.filePaths.add(filePath);
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
}