From 621af5205f411f26fc9d191a68524080ef6a8609 Mon Sep 17 00:00:00 2001 From: TaYaKi71751 Date: Sat, 5 Oct 2024 17:34:16 +0900 Subject: [PATCH] Try jsonDecode in try/catch Fix #552 --- violet/lib/pages/settings/login/ehentai_login.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/violet/lib/pages/settings/login/ehentai_login.dart b/violet/lib/pages/settings/login/ehentai_login.dart index 581130d7d..c38416968 100644 --- a/violet/lib/pages/settings/login/ehentai_login.dart +++ b/violet/lib/pages/settings/login/ehentai_login.dart @@ -62,9 +62,11 @@ class _LoginScreenState extends State { Future _checkCookie() async { final controller = await _webViewController.future; - final cookieString = jsonDecode( - await controller.runJavascriptReturningResult('document.cookie')) - as String; + var cookieString = + await controller.runJavascriptReturningResult('document.cookie'); + try { + cookieString = jsonDecode(cookieString) as String; + } catch (e) {} final cookies = parseCookies(cookieString); developer.log('Get cookies: $cookies');