From 84ce343895cb778edc85c4d85e1ca5beb3067617 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 15 Oct 2021 11:29:40 +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 --- .../legado/app/api/controller/BookSourceController.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/api/controller/BookSourceController.kt b/app/src/main/java/io/legado/app/api/controller/BookSourceController.kt index 1a73d70e4..588ef4396 100644 --- a/app/src/main/java/io/legado/app/api/controller/BookSourceController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookSourceController.kt @@ -46,12 +46,13 @@ object BookSourceController { val okSources = arrayListOf() val bookSources = GSON.fromJsonArray(postData) if (bookSources != null) { - for (bookSource in bookSources) { - if (bookSource.bookSourceName.isBlank() || bookSource.bookSourceUrl.isBlank()) { - continue + bookSources.forEach { bookSource -> + if (bookSource.bookSourceName.isNotBlank() + && bookSource.bookSourceUrl.isNotBlank() + ) { + appDb.bookSourceDao.insert(bookSource) + okSources.add(bookSource) } - appDb.bookSourceDao.insert(bookSource) - okSources.add(bookSource) } } else { return ReturnData().setErrorMsg("转换源失败")