Unverified Commit fdb7bd3c authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] attempt to fix .first crasher in web loading (#52301)

parent 2133343a
...@@ -234,6 +234,9 @@ class ChromeLauncher { ...@@ -234,6 +234,9 @@ class ChromeLauncher {
final HttpClientRequest request = await client.getUrl(base.resolve('/json/list')); final HttpClientRequest request = await client.getUrl(base.resolve('/json/list'));
final HttpClientResponse response = await request.close(); final HttpClientResponse response = await request.close();
final List<dynamic> jsonObject = await json.fuse(utf8).decoder.bind(response).single as List<dynamic>; final List<dynamic> jsonObject = await json.fuse(utf8).decoder.bind(response).single as List<dynamic>;
if (jsonObject == null || jsonObject.isEmpty) {
return base;
}
return base.resolve(jsonObject.first['devtoolsFrontendUrl'] as String); return base.resolve(jsonObject.first['devtoolsFrontendUrl'] as String);
} on Exception { } on Exception {
// If we fail to talk to the remote debugger protocol, give up and return // If we fail to talk to the remote debugger protocol, give up and return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment