From bf4d53f14d5ddaecfd544ab0b72d5434c27b4900 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Feb 2019 16:06:49 +0100 Subject: [PATCH] catch exceptions thrown at deleting invalid cached files too --- .../simplemobiletools/gallery/pro/extensions/Context.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 0cff4cd7a..df67d2b61 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 @@ -573,8 +573,11 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag } } - if (mediaToDelete.isNotEmpty()) { - mediumDao.deleteMedia(*mediaToDelete.toTypedArray()) + try { + if (mediaToDelete.isNotEmpty()) { + mediumDao.deleteMedia(*mediaToDelete.toTypedArray()) + } + } catch (ignored: Exception) { } }.start() }