From 45cf8da60f8c936a795e658b1aafefed8cc9c794 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 May 2022 10:44:40 +0200 Subject: [PATCH] catch exceptions thrown at getDeletedMediaCount() --- .../gallery/pro/activities/MainActivity.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 2b535ccd8..05b514a2b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -906,14 +906,17 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val dateTakens = mLastMediaFetcher!!.getDateTakens() if (config.showRecycleBinAtFolders && !config.showRecycleBinLast && !dirs.map { it.path }.contains(RECYCLE_BIN)) { - if (mediaDB.getDeletedMediaCount() > 0) { - val recycleBin = Directory().apply { - path = RECYCLE_BIN - name = getString(R.string.recycle_bin) - location = LOCATION_INTERNAL - } + try { + if (mediaDB.getDeletedMediaCount() > 0) { + val recycleBin = Directory().apply { + path = RECYCLE_BIN + name = getString(R.string.recycle_bin) + location = LOCATION_INTERNAL + } - dirs.add(0, recycleBin) + dirs.add(0, recycleBin) + } + } catch (ignored: Exception) { } }