Don't run decode job if fetch job failed

Fix fetch error being suppressed by decode job result.
This commit is contained in:
FooIbar committed 2024-03-31 20:39:27 +08:00
1 parent 7d137bb016
commit acb4fb6166
1 file changed
+4 -2
@@ -735,14 +735,16 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
val currentJob = mDecodeJobMap[index]
if (currentJob?.isActive != true) {
mDecodeJobMap[index] = launch {
doInJob(index)
mFetcherJobMap[index]?.join()
if (mPageStateArray[index] == STATE_FINISHED) {
doInJob(index)
}
}
}
}
}
private suspend fun doInJob(index: Int) {
mFetcherJobMap[index]?.takeIf { it.isActive }?.join()
runCatching {
val src = mSpiderDen.getImageSource(index) ?: return
val image = mSemaphore.withPermit { Image.decode(src) }