Merge pull request #1302 from Doflatango/fix/get_favicons_exception
Catch and ignore utf8 format exception in getFavicons()
This commit is contained in:
commit
741eb3964a
|
@ -1096,13 +1096,18 @@ class InAppWebViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manifestFound) {
|
if (manifestFound) {
|
||||||
Map<String, dynamic> manifest =
|
try {
|
||||||
json.decode(await manifestResponse!.transform(Utf8Decoder()).join());
|
Map<String, dynamic> manifest =
|
||||||
if (manifest.containsKey("icons")) {
|
json.decode(await manifestResponse!.transform(Utf8Decoder()).join());
|
||||||
for (Map<String, dynamic> icon in manifest["icons"]) {
|
if (manifest.containsKey("icons")) {
|
||||||
favicons.addAll(_createFavicons(webviewUrl, assetPathBase,
|
for (Map<String, dynamic> icon in manifest["icons"]) {
|
||||||
icon["src"], icon["rel"], icon["sizes"], true));
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue