Fix ChapterCache.isImageInCache() resource leak (#8907)
diskCache.get() returns a DiskLruCache.Snapshot which must be closed. (cherry picked from commit 8cea78de83744ea955d4cfb7dcad3ca8abf43223)
This commit is contained in:
parent
b30232ba9d
commit
822fda4d2b
@ -156,7 +156,7 @@ class ChapterCache(private val context: Context) {
|
|||||||
*/
|
*/
|
||||||
fun isImageInCache(imageUrl: String): Boolean {
|
fun isImageInCache(imageUrl: String): Boolean {
|
||||||
return try {
|
return try {
|
||||||
diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)) != null
|
diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)).use { it != null }
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user