catch exceptions at creating nomedia files on sd cards
This commit is contained in:
parent
e53d6a5c20
commit
2c73864d74
1 changed files with 6 additions and 2 deletions
|
@ -218,7 +218,11 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
|
||||||
|
|
||||||
if (needsStupidWritePermissions(path)) {
|
if (needsStupidWritePermissions(path)) {
|
||||||
handleSAFDialog(file) {
|
handleSAFDialog(file) {
|
||||||
|
try {
|
||||||
getFileDocument(path)?.createFile("", NOMEDIA)
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue