diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index ead1336a2..b1663b850 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -218,7 +218,11 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) { if (needsStupidWritePermissions(path)) { handleSAFDialog(file) { - getFileDocument(path)?.createFile("", NOMEDIA) + try { + getFileDocument(path)?.createFile("", NOMEDIA) + } catch (e: Exception) { + toast(R.string.unknown_error_occurred) + } } } else { try { @@ -228,7 +232,7 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) { } } scanFile(file) { - callback.invoke() + callback() } }