From fdb7bd3c0fcf4cb62d959aa495aaa9733574ca4d Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 10 Mar 2020 12:09:37 -0700 Subject: [PATCH] [flutter_tools] attempt to fix .first crasher in web loading (#52301) --- packages/flutter_tools/lib/src/web/chrome.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/flutter_tools/lib/src/web/chrome.dart b/packages/flutter_tools/lib/src/web/chrome.dart index 19166dabf6d..55a998bcd49 100644 --- a/packages/flutter_tools/lib/src/web/chrome.dart +++ b/packages/flutter_tools/lib/src/web/chrome.dart @@ -234,6 +234,9 @@ class ChromeLauncher { final HttpClientRequest request = await client.getUrl(base.resolve('/json/list')); final HttpClientResponse response = await request.close(); final List jsonObject = await json.fuse(utf8).decoder.bind(response).single as List; + if (jsonObject == null || jsonObject.isEmpty) { + return base; + } return base.resolve(jsonObject.first['devtoolsFrontendUrl'] as String); } on Exception { // If we fail to talk to the remote debugger protocol, give up and return