catch exceptions thrown at fetching nomedia folders

This commit is contained in:
tibbi 2020-11-01 17:26:21 +01:00
parent 7093640f66
commit 8896730d8b
2 changed files with 3 additions and 2 deletions

View file

@ -77,7 +77,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.31.16' implementation 'com.simplemobiletools:commons:5.31.17'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'

View file

@ -326,10 +326,11 @@ fun Context.getNoMediaFoldersSync(): ArrayList<String> {
val path = cursor.getStringValue(Files.FileColumns.DATA) ?: continue val path = cursor.getStringValue(Files.FileColumns.DATA) ?: continue
val noMediaFile = File(path) val noMediaFile = File(path)
if (getDoesFilePathExist(noMediaFile.absolutePath, OTGPath) && noMediaFile.name == NOMEDIA) { if (getDoesFilePathExist(noMediaFile.absolutePath, OTGPath) && noMediaFile.name == NOMEDIA) {
folders.add("${noMediaFile.parent}") folders.add(noMediaFile.parent)
} }
} while (cursor.moveToNext()) } while (cursor.moveToNext())
} }
} catch (ignored: Exception) {
} finally { } finally {
cursor?.close() cursor?.close()
} }