From 45408b7cc2ecb1e6c8a54824a5d4373ad387c28e Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 21 Nov 2021 12:17:54 +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 --- .../main/java/io/legado/app/help/http/BackstageWebView.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt b/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt index 9fedea7fa..914b9400f 100644 --- a/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt +++ b/app/src/main/java/io/legado/app/help/http/BackstageWebView.kt @@ -3,6 +3,7 @@ package io.legado.app.help.http import android.annotation.SuppressLint import android.os.Handler import android.os.Looper +import android.util.AndroidRuntimeException import android.webkit.CookieManager import android.webkit.WebSettings import android.webkit.WebView @@ -51,7 +52,11 @@ class BackstageWebView( } } runOnUI { - load() + try { + load() + } catch (error: Throwable) { + block.cancel(error) + } } } @@ -59,6 +64,7 @@ class BackstageWebView( return encode ?: "utf-8" } + @Throws(AndroidRuntimeException::class) private fun load() { val webView = createWebView() mWebView = webView