[flutter_tools] attempt to fix .first crasher in web loading (#52301)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user