From 612d11a3ef74a9c0ac3573ee7e51fbf33d1fd1a3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 26 Aug 2021 09:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B9=A6=E6=BA=90=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=AD=A3=E6=96=87=E4=B8=8B=E4=B8=80=E9=A1=B5=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=88=AA=E6=AD=A2=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/data/entities/BookSource.kt | 2 +- .../java/io/legado/app/service/CheckSourceService.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index 4fe694709..a6e4a4bff 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -50,7 +50,7 @@ data class BookSource( @delegate:Transient @delegate:Ignore @IgnoredOnParcel - val exploreKinds by lazy { + val exploreKinds: List by lazy { val exploreUrl = exploreUrl ?: return@lazy emptyList() val kinds = arrayListOf() var ruleStr = exploreUrl diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index 00aeaf374..c706dbf39 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -113,9 +113,6 @@ class CheckSourceService : BaseService() { var books = webBook.searchBookAwait(this, CheckSource.keyword) if (books.isEmpty()) { val exs = source.exploreKinds - if (exs.isEmpty()) { - throw Exception("搜索内容为空并且没有发现") - } var url: String? = null for (ex in exs) { url = ex.url @@ -123,11 +120,14 @@ class CheckSourceService : BaseService() { break } } - books = webBook.exploreBookAwait(this, url!!) + if (url.isNullOrBlank()) { + throw Exception("搜索内容为空并且没有发现") + } + books = webBook.exploreBookAwait(this, url) } val book = webBook.getBookInfoAwait(this, books.first().toBook()) val toc = webBook.getChapterListAwait(this, book) - val content = webBook.getContentAwait(this, book, toc.first()) + val content = webBook.getContentAwait(this, book, toc.first(), toc.getOrNull(2)?.url) if (content.isBlank()) { throw Exception("正文内容为空") }