From 4a67405303d248ccbacec70d37b78731c4c176bd Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 26 Aug 2021 16:41:47 +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 --- .../java/io/legado/app/api/controller/SourceController.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/api/controller/SourceController.kt b/app/src/main/java/io/legado/app/api/controller/SourceController.kt index f4a92cd6d..80dd7d783 100644 --- a/app/src/main/java/io/legado/app/api/controller/SourceController.kt +++ b/app/src/main/java/io/legado/app/api/controller/SourceController.kt @@ -5,9 +5,9 @@ import android.text.TextUtils import io.legado.app.api.ReturnData import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource +import io.legado.app.help.BookSourceAnalyzer import io.legado.app.utils.GSON import io.legado.app.utils.fromJsonArray -import io.legado.app.utils.fromJsonObject import io.legado.app.utils.msg object SourceController { @@ -23,8 +23,9 @@ object SourceController { fun saveSource(postData: String?): ReturnData { val returnData = ReturnData() + postData ?: return returnData.setErrorMsg("数据不能为空") kotlin.runCatching { - val bookSource = GSON.fromJsonObject(postData) + val bookSource = BookSourceAnalyzer.jsonToBookSource(postData) if (bookSource != null) { if (TextUtils.isEmpty(bookSource.bookSourceName) || TextUtils.isEmpty(bookSource.bookSourceUrl)) { returnData.setErrorMsg("书源名称和URL不能为空")