Prevent random FileNotFoundException when reading chapters (#3154)
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
@@ -27,6 +27,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Add missing `outlineVariant` color to Nord theme ([@CompileConnected](https://github.com/CompileConnected)) ([#3184](https://github.com/mihonapp/mihon/pull/3184))
|
- Add missing `outlineVariant` color to Nord theme ([@CompileConnected](https://github.com/CompileConnected)) ([#3184](https://github.com/mihonapp/mihon/pull/3184))
|
||||||
- Continue reading button missing when unread filter is off ([@AntsyLich](https://github.com/AntsyLich)) ([#3382](https://github.com/mihonapp/mihon/pull/3382))
|
- Continue reading button missing when unread filter is off ([@AntsyLich](https://github.com/AntsyLich)) ([#3382](https://github.com/mihonapp/mihon/pull/3382))
|
||||||
|
- Fix random `FileNotFoundException` when reading chapters ([@leodyversemilla07](https://github.com/leodyversemilla07)) ([#3154](https://github.com/mihonapp/mihon/pull/3154))
|
||||||
|
|
||||||
## [v0.19.9] - 2026-04-11
|
## [v0.19.9] - 2026-04-11
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -113,7 +113,13 @@ class ChapterCache(
|
|||||||
*/
|
*/
|
||||||
fun isImageInCache(imageUrl: String): Boolean {
|
fun isImageInCache(imageUrl: String): Boolean {
|
||||||
return try {
|
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) {
|
} catch (_: IOException) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user