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

diskCache.get() returns a DiskLruCache.Snapshot which must be closed.
This commit is contained in:
Two-Ai 2023-01-13 22:30:26 -05:00 committed by Jays2Kings
parent 3206ef825e
commit 8ab47139f2

View file

@ -181,7 +181,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
}