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
This commit is contained in:
Greg Spencer
2018-08-14 10:04:44 -07:00
committed by GitHub
parent 33c4cd0f39
commit 7bdd31f7aa

View File

@@ -285,8 +285,12 @@ class _Compiler {
}
Future<dynamic> 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<T> handleTimeout<T>(Future<T> value, String path) {