From 6e4323f247e1012d15d2aa9e5efac8a0efb65dc3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 13 Nov 2020 08:59:16 +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/help/JsExtensions.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 22fbd5fcf..642905691 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -192,11 +192,17 @@ interface JsExtensions { return str.htmlFormat() } - fun base64DecodeToByteArray(str: String): ByteArray { + fun base64DecodeToByteArray(str: String?): ByteArray? { + if (str.isNullOrBlank()) { + return null + } return Base64.decode(str, Base64.DEFAULT) } - fun base64DecodeToByteArray(str: String, flags: Int): ByteArray { + fun base64DecodeToByteArray(str: String?, flags: Int): ByteArray? { + if (str.isNullOrBlank()) { + return null + } return Base64.decode(str, flags) }