diff --git a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart index 8dafe81ab4e9..c3ee9cd313b6 100644 --- a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart +++ b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart @@ -186,7 +186,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { @override void visitNode(AstNode node) { - node.parent.accept(this); + // Support the case of searching partial ASTs by aborting on nodes with no + // parents. This is useful for the angular plugin. + node.parent?.accept(this); } @override