From e31be23bf4ec763b7acc686085804f8ec0b672c5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Feb 2019 16:00:18 +0100 Subject: [PATCH] do not trigger the database deleteMedia file, if there is nothing to delete --- .../com/simplemobiletools/gallery/pro/extensions/Context.kt | 4 +++- 1 file changed, 3 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 a7663f123..d28a14f79 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,7 +573,9 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag } } - mediumDao.deleteMedia(*mediaToDelete.toTypedArray()) + if (mediaToDelete.isNotEmpty()) { + mediumDao.deleteMedia(*mediaToDelete.toTypedArray()) + } }.start() }