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) }