From 18835d22de13650e60b3b26c28e50c89847d51c2 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 7 Sep 2021 16:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/model/CacheBook.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/CacheBook.kt b/app/src/main/java/io/legado/app/model/CacheBook.kt index a4b2745ee..41eb581e8 100644 --- a/app/src/main/java/io/legado/app/model/CacheBook.kt +++ b/app/src/main/java/io/legado/app/model/CacheBook.kt @@ -197,9 +197,17 @@ class CacheBook(var bookSource: BookSource, var book: Book) { chapter, context = context ).onSuccess { content -> - onSuccess(chapterIndex) - addLog("${book.name}-${chapter.title} getContentSuccess") - downloadFinish(chapter, content.ifBlank { "No content" }) + if (content.isNotBlank()) { + onSuccess(chapterIndex) + addLog("${book.name}-${chapter.title} getContentSuccess") + downloadFinish(chapter, content.ifBlank { "No content" }) + } else { + //出现错误等待1秒后重新加入待下载列表 + delay(1000) + onErrorOrCancel(chapterIndex) + addLog("${book.name}-${chapter.title} getContentError 内容为空") + downloadFinish(chapter, "download error 内容为空") + } }.onError { //出现错误等待1秒后重新加入待下载列表 delay(1000)