catching some exceptions thrown related to handling cache db
This commit is contained in:
parent
c64fe82c02
commit
e7624ea7d7
2 changed files with 13 additions and 5 deletions
|
@ -917,11 +917,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
setupAdapter(dirs)
|
||||
try {
|
||||
mDirectoryDao.insert(newDir)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
if (folder != RECYCLE_BIN) {
|
||||
mMediumDao.insertAll(newMedia)
|
||||
}
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
mLoadedInitialPhotos = true
|
||||
|
|
|
@ -592,7 +592,10 @@ fun Context.removeInvalidDBDirectories(dirs: ArrayList<Directory>? = null, direc
|
|||
fun Context.updateDBMediaPath(oldPath: String, newPath: String) {
|
||||
val newFilename = newPath.getFilenameFromPath()
|
||||
val newParentPath = newPath.getParentPath()
|
||||
try {
|
||||
galleryDB.MediumDao().updateMedium(oldPath, newParentPath, newFilename, newPath)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.updateDBDirectory(directory: Directory, directoryDao: DirectoryDao) {
|
||||
|
@ -609,7 +612,12 @@ fun Context.getFavoritePaths(): ArrayList<String> {
|
|||
|
||||
// remove the "recycle_bin" from the file path prefix, replace it with real bin path /data/user...
|
||||
fun Context.getUpdatedDeletedMedia(mediumDao: MediumDao): ArrayList<Medium> {
|
||||
val media = mediumDao.getDeletedMedia() as ArrayList<Medium>
|
||||
val media = try {
|
||||
mediumDao.getDeletedMedia() as ArrayList<Medium>
|
||||
} catch (ignored: Exception) {
|
||||
ArrayList<Medium>()
|
||||
}
|
||||
|
||||
media.forEach {
|
||||
it.path = File(recycleBinPath, it.path.removePrefix(RECYCLE_BIN)).toString()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue