Skip to content

Commit

Permalink
Guard against an NPE in incomplete code (issue 37150)
Browse files Browse the repository at this point in the history
Change-Id: Idd5a0936ccd435c12ac9b4f36151204a2b01127a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107307
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Brian Wilkerson <[email protected]>
  • Loading branch information
bwilkerson authored and [email protected] committed Jun 25, 2019
1 parent fe37377 commit 89e2118
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,8 @@ class AssistProcessor {
return;
}
ConstructorElement element = creation.staticElement;
if (element.name != 'fromIterable' ||
if (element == null ||
element.name != 'fromIterable' ||
element.enclosingElement != typeProvider.mapType.element) {
_coverageMarker();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,14 @@ f(Iterable<int> i) {
}
''');
}

test_undefinedConstructor() async {
verifyNoTestUnitErrors = false;
await resolveTestUnit('''
f() {
return new Unde/*caret*/fined();
}
''');
await assertNoAssist();
}
}

0 comments on commit 89e2118

Please sign in to comment.