catch exceptions thrown at clearing the recycle bin

This commit is contained in:
tibbi 2019-06-27 09:52:11 +02:00
parent 44014ef44a
commit f066f4b84a

View file

@ -293,11 +293,15 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList<String>, mediumDa
fun BaseSimpleActivity.emptyTheRecycleBin(callback: (() -> Unit)? = null) { fun BaseSimpleActivity.emptyTheRecycleBin(callback: (() -> Unit)? = null) {
Thread { Thread {
recycleBin.deleteRecursively() try {
galleryDB.MediumDao().clearRecycleBin() recycleBin.deleteRecursively()
galleryDB.DirectoryDao().deleteRecycleBin() galleryDB.MediumDao().clearRecycleBin()
toast(R.string.recycle_bin_emptied) galleryDB.DirectoryDao().deleteRecycleBin()
callback?.invoke() toast(R.string.recycle_bin_emptied)
callback?.invoke()
} catch (e: Exception) {
toast(R.string.unknown_error_occurred)
}
}.start() }.start()
} }