mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
catch exceptions at creating nomedia files on sd cards
This commit is contained in:
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user