catching an exception at inserting directories in db

This commit is contained in:
tibbi 2019-02-22 12:43:16 +01:00
parent a4b42b5522
commit 29e1220c84
1 changed files with 6 additions and 2 deletions

View File

@ -915,7 +915,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, isSortingAscending) val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, isSortingAscending)
dirs.add(newDir) dirs.add(newDir)
setupAdapter(dirs) setupAdapter(dirs)
mDirectoryDao.insert(newDir) try {
mDirectoryDao.insert(newDir)
} catch (ignored: Exception) {
}
if (folder != RECYCLE_BIN) { if (folder != RECYCLE_BIN) {
mMediumDao.insertAll(newMedia) mMediumDao.insertAll(newMedia)
} }
@ -1075,7 +1078,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList() 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() { private fun setupLatestMediaId() {
Thread { Thread {