Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
index dc66c4507cf10a21a13bc34615905fef6e3bb430..a33d280fe75cd346087c593f82cef1cadc3ab2d0 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
@@ -1990,13 +1990,17 @@ class FixProcessor { |
} |
ClassElement targetClassElement = targetType.element as ClassElement; |
targetElement = targetClassElement; |
- // may be static |
+ // prepare target ClassDeclaration |
+ AstNode targetTypeNode = getParsedClassElementNode(targetClassElement); |
+ if (targetTypeNode is! ClassDeclaration) { |
+ return; |
+ } |
+ ClassDeclaration targetClassNode = targetTypeNode; |
+ // maybe static |
if (target is Identifier) { |
staticModifier = target.bestElement.kind == ElementKind.CLASS; |
} |
// prepare insert offset |
- ClassDeclaration targetClassNode = |
- getParsedClassElementNode(targetClassElement); |
prefix = ' '; |
insertOffset = targetClassNode.end - 1; |
if (targetClassNode.members.isEmpty) { |