From fbda243c0d8477da18c39a12327e1b98d57093fe Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 21 Oct 2022 16:57:13 -0400 Subject: [PATCH] Avoid crashing during eager WebView init --- .../tachiyomi/network/interceptor/WebViewInterceptor.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/WebViewInterceptor.kt b/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/WebViewInterceptor.kt index 45e70efbe..9ebe92965 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/WebViewInterceptor.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/WebViewInterceptor.kt @@ -38,7 +38,11 @@ abstract class WebViewInterceptor(private val context: Context) : Interceptor { return@lazy } - WebSettings.getDefaultUserAgent(context) + try { + WebSettings.getDefaultUserAgent(context) + } catch (_: Exception) { + // Avoid some crashes like when Chrome/WebView is being updated. + } } abstract fun shouldIntercept(response: Response): Boolean