From 54312adb7533d444056b6ca607bf11fc52cd4d79 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Feb 2019 16:05:56 +0100 Subject: [PATCH] catch exceptions thrown at getting favorite paths --- .../simplemobiletools/gallery/pro/extensions/Context.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 {