From 7bdd31f7aad8dcb748ca9614c7cfa197fcbab18a Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Tue, 14 Aug 2018 10:04:44 -0700 Subject: [PATCH] Fix access of null compiler in flutter tests that fail before creating the compiler. (#20553) In certain cases, the test would fail before creating the (lazily created) compiler object, and then we'd try to call shutdown() on null in those cases. Fixes #18610 --- packages/flutter_tools/lib/src/test/flutter_platform.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart index ea41b90fac..fc057731b1 100644 --- a/packages/flutter_tools/lib/src/test/flutter_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart @@ -285,8 +285,12 @@ class _Compiler { } Future shutdown() async { - await compiler.shutdown(); - compiler = null; + // Check for null in case this instance is shut down before the + // lazily-created compiler has been created. + if (compiler != null) { + await compiler.shutdown(); + compiler = null; + } } static Future handleTimeout(Future value, String path) {