From 789bfa42718e7f21ad00e140aec5150939e5ee20 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 19 Aug 2016 14:40:14 -0700 Subject: [PATCH] Do not throw when resolving a local engine if the .packages map does not include the flutter package (#5519) --- .../lib/src/runner/flutter_command_runner.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart index a270dd3ea6..5708043e99 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart @@ -189,10 +189,12 @@ class FlutterCommandRunner extends CommandRunner { if (engineSourcePath == null && globalResults['local-engine'] != null) { try { Uri engineUri = new PackageMap(PackageMap.globalPackagesPath).map[kFlutterEnginePackageName]; - engineSourcePath = path.dirname(path.dirname(path.dirname(path.dirname(engineUri.path)))); - bool dirExists = FileSystemEntity.isDirectorySync(path.join(engineSourcePath, 'out')); - if (engineSourcePath == '/' || engineSourcePath.isEmpty || !dirExists) - engineSourcePath = null; + if (engineUri != null) { + engineSourcePath = path.dirname(path.dirname(path.dirname(path.dirname(engineUri.path)))); + bool dirExists = FileSystemEntity.isDirectorySync(path.join(engineSourcePath, 'out')); + if (engineSourcePath == '/' || engineSourcePath.isEmpty || !dirExists) + engineSourcePath = null; + } } on FileSystemException { } on FormatException { } if (engineSourcePath == null)