Skip to content

Commit cb1abe9

Browse files
danrubelwhesse
danrubel
authored andcommitted
fix completion exception - fixes #24630
[email protected] Review URL: https://codereview.chromium.org/1418093003 .
1 parent 4a97aa0 commit cb1abe9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,16 @@ class InterfaceTypeSuggestionBuilder {
436436
{bool isSuper: false, String containingMethodName: null}) {
437437
CompilationUnit compilationUnit =
438438
request.target.containingNode.getAncestor((n) => n is CompilationUnit);
439-
LibraryElement library = compilationUnit.element.library;
439+
CompilationUnitElement unitElem = compilationUnit.element;
440+
if (unitElem == null) {
441+
return;
442+
}
443+
LibraryElement library = unitElem.library;
440444
if (type is DynamicTypeImpl) {
441445
type = request.cache.objectClassElement.type;
442446
}
443447
if (type is InterfaceType) {
444-
return new InterfaceTypeSuggestionBuilder(request)
448+
new InterfaceTypeSuggestionBuilder(request)
445449
._buildSuggestions(type, library, isSuper, containingMethodName);
446450
}
447451
}

0 commit comments

Comments
 (0)