Unverified Commit 3f163d29 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Return an empty FlutterViews list when the service disappears (#75301)

parent 9ae10d0f
...@@ -779,7 +779,10 @@ extension FlutterVmService on vm_service.VmService { ...@@ -779,7 +779,10 @@ extension FlutterVmService on vm_service.VmService {
kListViewsMethod, kListViewsMethod,
); );
if (response == null) { if (response == null) {
return null; // The service may have disappeared mid-request.
// Return an empty list now, and let the shutdown logic elsewhere deal
// with cleaning up.
return <FlutterView>[];
} }
final List<Object> rawViews = response.json['views'] as List<Object>; final List<Object> rawViews = response.json['views'] as List<Object>;
final List<FlutterView> views = <FlutterView>[ final List<FlutterView> views = <FlutterView>[
......
...@@ -356,7 +356,7 @@ void main() { ...@@ -356,7 +356,7 @@ void main() {
expect(skSLs, isNull); expect(skSLs, isNull);
final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews(); final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews();
expect(views, isNull); expect(views, isEmpty);
final vm_service.Response screenshot = await fakeVmServiceHost.vmService.screenshot(); final vm_service.Response screenshot = await fakeVmServiceHost.vmService.screenshot();
expect(screenshot, isNull); expect(screenshot, isNull);
......
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