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 0ab8a8bbff15dd5850f1a372a2a74ef9f3050c92..3d621cf0043670395b1f96baf494069035793162 100644 |
--- a/pkg/analyzer/lib/src/task/strong_mode.dart |
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart |
@@ -29,7 +29,10 @@ void setFieldType(VariableElement field, DartType newType) { |
if (field is PropertyInducingElementImpl) { |
(field.getter as ExecutableElementImpl).returnType = newType; |
if (!field.isFinal && !field.isConst) { |
- (field.setter.parameters[0] as ParameterElementImpl).type = newType; |
+ List<ParameterElement> setterParameters = field.setter.parameters; |
+ if (setterParameters.isNotEmpty) { |
+ (setterParameters[0] as ParameterElementImpl).type = newType; |
+ } |
} |
} |
} |