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 55f480b4f..022bb4761 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 @@ -742,10 +742,13 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag } if (mediaToDelete.isNotEmpty()) { - mediaDB.deleteMedia(*mediaToDelete.toTypedArray()) + try { + mediaDB.deleteMedia(*mediaToDelete.toTypedArray()) - mediaToDelete.filter { it.isFavorite }.forEach { - favoritesDB.deleteFavoritePath(it.path) + mediaToDelete.filter { it.isFavorite }.forEach { + favoritesDB.deleteFavoritePath(it.path) + } + } catch (ignored: Exception) { } } }.start()