Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Unified Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 2200223002: Guard against NPE (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong_mode.dart
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart
index 420fd61c972aa62d41a511067e458889fac32c52..ea4e0b349010cacd68764464160adda7a6a8c636 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -279,6 +279,12 @@ class InstanceMemberInferrer {
List<FunctionType> overriddenTypes = new List<FunctionType>();
for (ExecutableElement overriddenMethod in overriddenMethods) {
FunctionType overriddenType = overriddenMethod.type;
+ if (overriddenType == null) {
+ // TODO(brianwilkerson) I think the overridden method should always have
+ // a type, but there appears to be a bug that causes it to sometimes be
+ // null, we guard against that case by not performing inference.
+ return;
+ }
if (overriddenType.typeFormals.isNotEmpty) {
if (overriddenType.typeFormals.length != typeFormals.length) {
return;
@@ -466,6 +472,7 @@ class VariableGatherer extends RecursiveAstVisitor {
}
return element;
}
+
Element element = nonAccessor(node.staticElement);
if (element is VariableElement && (filter == null || filter(element))) {
results.add(element);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698