From 04501af955b8c65570da63911a8a5c865b6843a2 Mon Sep 17 00:00:00 2001 From: Jim Beveridge Date: Wed, 11 Nov 2015 17:09:32 -0800 Subject: [PATCH] Fixes assert connecting to Activity service under Linux Fixes #313. --- packages/flutter/lib/src/services/shell.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/flutter/lib/src/services/shell.dart b/packages/flutter/lib/src/services/shell.dart index 86856c807e..cacd14eafd 100644 --- a/packages/flutter/lib/src/services/shell.dart +++ b/packages/flutter/lib/src/services/shell.dart @@ -29,10 +29,10 @@ ShellProxy _initShellProxy() { ApplicationConnection _initEmbedderConnection() { core.MojoHandle servicesHandle = new core.MojoHandle(internals.takeServicesProvidedByEmbedder()); core.MojoHandle exposedServicesHandle = new core.MojoHandle(internals.takeServicesProvidedToEmbedder()); - ServiceProviderProxy services = servicesHandle.isValid ? - new ServiceProviderProxy.fromHandle(servicesHandle) : null; - ServiceProviderStub exposedServices = exposedServicesHandle.isValid ? - new ServiceProviderStub.fromHandle(exposedServicesHandle) : null; + if (!servicesHandle.isValid || !exposedServicesHandle.isValid) + return null; + ServiceProviderProxy services = new ServiceProviderProxy.fromHandle(servicesHandle); + ServiceProviderStub exposedServices = new ServiceProviderStub.fromHandle(exposedServicesHandle); return new ApplicationConnection(exposedServices, services); } @@ -56,7 +56,7 @@ class _Shell { if (_shell == null || url == null) { // If we don't have a shell or a url, we try to get the services from the // embedder directly instead of using the shell to connect. - _embedderConnection.requestService(proxy); + _embedderConnection?.requestService(proxy); return; }