diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d1b0303..b5c1ce41 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ - Merged "Android - Load client certificate from local storage" [#1241](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1241) (thanks to [akioyamamoto1977](https://github.com/akioyamamoto1977)) - Merged "fix Theme_AppCompat_Dialog_Alert not found" [#1262](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1262) (thanks to [mohenaxiba](https://github.com/mohenaxiba)) - Merged "Allow a cookie without a domain to be set on Android" [#1295](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1295) (thanks to [bagedevimo](https://github.com/bagedevimo)) +- Merged "Catch and ignore utf8 format exception in getFavicons()" [#1302](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1302) (thanks to [Doflatango](https://github.com/Doflatango)) ## 5.4.4+3 diff --git a/lib/src/in_app_webview/in_app_webview_controller.dart b/lib/src/in_app_webview/in_app_webview_controller.dart index 83ca4848..9fcf9f25 100644 --- a/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1533,13 +1533,18 @@ class InAppWebViewController { } if (manifestFound) { - Map manifest = - json.decode(await manifestResponse!.transform(Utf8Decoder()).join()); - if (manifest.containsKey("icons")) { - for (Map icon in manifest["icons"]) { - favicons.addAll(_createFavicons(webviewUrl, assetPathBase, - icon["src"], icon["rel"], icon["sizes"], true)); + try { + Map manifest = + json.decode(await manifestResponse!.transform(Utf8Decoder()).join()); + if (manifest.containsKey("icons")) { + for (Map icon in manifest["icons"]) { + favicons.addAll(_createFavicons(webviewUrl, assetPathBase, + icon["src"], icon["rel"], icon["sizes"], true)); + } } + } on FormatException catch (_) { + /// The [manifestResponse] might not has a valid JSON string, catch and + /// ignore the error } }