Prevent random FileNotFoundException when reading chapters (#3154)
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
@@ -113,7 +113,13 @@ class ChapterCache(
|
||||
*/
|
||||
fun isImageInCache(imageUrl: String): Boolean {
|
||||
return try {
|
||||
diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)).use { it != null }
|
||||
val key = DiskUtil.hashKeyForDisk(imageUrl)
|
||||
val inJournal = diskCache.get(key).use { it != null }
|
||||
val fileExists = getImageFile(imageUrl).exists()
|
||||
if (inJournal && !fileExists) {
|
||||
logcat(LogPriority.WARN) { "Image is in journal but file is missing: $imageUrl" }
|
||||
}
|
||||
inJournal && fileExists
|
||||
} catch (_: IOException) {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user