merged Catch and ignore utf8 format exception in getFavicons()

This commit is contained in:
Lorenzo Pichilli 2022-10-13 19:55:23 +02:00
parent 45ef5c3755
commit f634c1ed83
2 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -1533,13 +1533,18 @@ class InAppWebViewController {
}
if (manifestFound) {
Map<String, dynamic> manifest =
json.decode(await manifestResponse!.transform(Utf8Decoder()).join());
if (manifest.containsKey("icons")) {
for (Map<String, dynamic> icon in manifest["icons"]) {
favicons.addAll(_createFavicons(webviewUrl, assetPathBase,
icon["src"], icon["rel"], icon["sizes"], true));
try {
Map<String, dynamic> manifest =
json.decode(await manifestResponse!.transform(Utf8Decoder()).join());
if (manifest.containsKey("icons")) {
for (Map<String, dynamic> 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
}
}