diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index d28a14f79..0cff4cd7a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -596,7 +596,13 @@ fun Context.updateDBDirectory(directory: Directory, directoryDao: DirectoryDao) directoryDao.updateDirectory(directory.path, directory.tmb, directory.mediaCnt, directory.modified, directory.taken, directory.size, directory.types) } -fun Context.getFavoritePaths() = galleryDB.MediumDao().getFavoritePaths() as ArrayList +fun Context.getFavoritePaths(): ArrayList { + return try { + galleryDB.MediumDao().getFavoritePaths() as ArrayList + } catch (e: Exception) { + ArrayList() + } +} // remove the "recycle_bin" from the file path prefix, replace it with real bin path /data/user... fun Context.getUpdatedDeletedMedia(mediumDao: MediumDao): ArrayList {