Browse Source

Fix ChapterCache.isImageInCache() resource leak (#8907)

diskCache.get() returns a DiskLruCache.Snapshot which must be closed.
Two-Ai 2 years ago
parent
commit
8cea78de83
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt

@@ -128,7 +128,7 @@ class ChapterCache(private val context: Context) {
      */
     fun isImageInCache(imageUrl: String): Boolean {
         return try {
-            diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)) != null
+            diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)).use { it != null }
         } catch (e: IOException) {
             false
         }