From 29e1220c84405c63615d5557dbbba3b977c42a02 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 22 Feb 2019 12:43:16 +0100 Subject: [PATCH] catching an exception at inserting directories in db --- .../gallery/pro/activities/MainActivity.kt | 8 ++++++-- 1 file changed, 6 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 a892a9586..5ccc5d1af 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 @@ -915,7 +915,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, isSortingAscending) dirs.add(newDir) setupAdapter(dirs) - mDirectoryDao.insert(newDir) + try { + mDirectoryDao.insert(newDir) + } catch (ignored: Exception) { + } if (folder != RECYCLE_BIN) { mMediumDao.insertAll(newMedia) } @@ -1075,7 +1078,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList() - private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this) ?: "" + private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this) + ?: "" private fun setupLatestMediaId() { Thread {