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

diskCache.get() returns a DiskLruCache.Snapshot which must be closed.
pull/8909/head
Two-Ai 2 years ago committed by GitHub
parent b6468c7e31
commit 8cea78de83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}

Loading…
Cancel
Save