Index: pkg/compiler/lib/src/compiler.dart |
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
index 7c1d58e9bf1576bc7b20d64185d89e4765119d79..d567bbaed7ccc89da0e7b15c5ed6d35bc4ee817e 100644 |
--- a/pkg/compiler/lib/src/compiler.dart |
+++ b/pkg/compiler/lib/src/compiler.dart |
@@ -922,7 +922,12 @@ abstract class Compiler implements LibraryLoaderListener { |
library.implementation.forEachLocalMember(enqueueAll); |
library.imports.forEach((ImportElement import) { |
if (import.isDeferred) { |
- world.addToWorkList(import.prefix.loadLibrary); |
+ // `import.prefix` and `loadLibrary` may be `null` when the deferred |
+ // import has compile-time errors. |
+ GetterElement loadLibrary = import.prefix?.loadLibrary; |
+ if (loadLibrary != null) { |
+ world.addToWorkList(loadLibrary); |
+ } |
} |
}); |
} |