From 3c8ec82bc73875308e58fafd74a9896e0076efd7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 17 May 2020 11:37:55 +0200 Subject: [PATCH] catching some exceptions thrown at inserting media in db --- .../gallery/pro/activities/MainActivity.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 5b8ecbb71..161e89604 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 @@ -958,11 +958,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { setupAdapter(dirs) - // update directories and media files in the local db, delete invalid items + // update directories and media files in the local db, delete invalid items. Intentionally creating a new thread updateDBDirectory(directory) if (!directory.isRecycleBin()) { Thread { - mediaDB.insertAll(curMedia) + try { + mediaDB.insertAll(curMedia) + } catch (ignored: Exception) { + } }.start() }