Skip to content

Commit baab34a

Browse files
danrubelkevmoo
danrubel
authored andcommitted
fix completion exception - fixes #24630
R=scheglov@google.com Review URL: https://codereview.chromium.org/1418093003 . (cherry picked from commit 6726ac5)
1 parent dae77f1 commit baab34a

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

+6-2
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)