catch exceptions at creating nomedia files on sd cards

This commit is contained in:
tibbi 2017-05-26 09:29:02 +02:00
parent e53d6a5c20
commit 2c73864d74

View file

@ -218,7 +218,11 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
if (needsStupidWritePermissions(path)) { if (needsStupidWritePermissions(path)) {
handleSAFDialog(file) { handleSAFDialog(file) {
getFileDocument(path)?.createFile("", NOMEDIA) try {
getFileDocument(path)?.createFile("", NOMEDIA)
} catch (e: Exception) {
toast(R.string.unknown_error_occurred)
}
} }
} else { } else {
try { try {
@ -228,7 +232,7 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
} }
} }
scanFile(file) { scanFile(file) {
callback.invoke() callback()
} }
} }