This commit is contained in:
Horis
2025-02-14 12:22:28 +08:00
parent b4afd83bc4
commit 494c9d57b9
3 changed files with 9 additions and 5 deletions
@@ -116,7 +116,7 @@ interface BaseSource : JsExtensions {
putAll(map) putAll(map)
} }
} catch (e: Exception) { } catch (e: Exception) {
AppLog.put("getHeaderMap 出错\n$e", e) AppLog.put("执行请求头规则出错\n$e", e)
} }
} }
if (!has(AppConst.UA_NAME, true)) { if (!has(AppConst.UA_NAME, true)) {
@@ -191,9 +191,9 @@ abstract class PageDelegate(protected val readView: ReadView) {
} }
fun postInvalidate() { fun postInvalidate() {
if (isRunning && this is HorizontalPageDelegate) { if (isStarted && isRunning && this is HorizontalPageDelegate) {
readView.post { readView.post {
if (isRunning) { if (isStarted && isRunning) {
setBitmap() setBitmap()
readView.invalidate() readView.invalidate()
} }
@@ -68,7 +68,9 @@ inline fun <reified T> Gson.fromJsonArray(json: String?): Result<List<T>> {
val type = TypeToken.getParameterized(List::class.java, T::class.java).type val type = TypeToken.getParameterized(List::class.java, T::class.java).type
val list = fromJson(json, type) as List<T?> val list = fromJson(json, type) as List<T?>
if (list.contains(null)) { if (list.contains(null)) {
throw JsonSyntaxException("存在null") throw JsonSyntaxException(
"列表不能存在null元素,可能是json格式错误,通常为列表存在多余的逗号所致"
)
} }
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
list as List<T> list as List<T>
@@ -94,7 +96,9 @@ inline fun <reified T> Gson.fromJsonArray(inputStream: InputStream?): Result<Lis
val type = TypeToken.getParameterized(List::class.java, T::class.java).type val type = TypeToken.getParameterized(List::class.java, T::class.java).type
val list = fromJson(reader, type) as List<T?> val list = fromJson(reader, type) as List<T?>
if (list.contains(null)) { if (list.contains(null)) {
throw JsonSyntaxException("存在null") throw JsonSyntaxException(
"列表不能存在null元素,可能是json格式错误,通常为列表存在多余的逗号所致"
)
} }
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
list as List<T> list as List<T>