commit | d72334e6a26e147e92da57a8601346cdbaf95ddf | [log] [tgz] |
---|---|---|
author | Brian Wilkerson <brianwilkerson@google.com> | Mon Aug 13 17:30:10 2018 +0000 |
committer | commit-bot@chromium.org <commit-bot@chromium.org> | Mon Aug 13 17:30:10 2018 +0000 |
tree | fa624c913059d41022801443d486e2d8d941485a | |
parent | 9619e2cd77d557e5a129a17aac9c76e023e819cc [diff] |
Prevent NPEs in the fix processor Change-Id: I2a5c12bf6f3aec4c8a504590f39b666c9934e4e4 Reviewed-on: https://dart-review.googlesource.com/68435 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
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 65931a3..fb2cd3e 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -289,6 +289,11 @@ node = new NodeLocator2(errorOffset).searchWithin(unit); coveredNode = new NodeLocator2(errorOffset, errorEnd - 1).searchWithin(unit); + if (coveredNode == null) { + // TODO(brianwilkerson) Figure out why the coveredNode is sometimes null. + return fixes; + } + // analyze ErrorCode ErrorCode errorCode = error.errorCode; if (errorCode == StaticWarningCode.UNDEFINED_CLASS_BOOLEAN) {
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart index da87c3d..00c0fe1 100644 --- a/pkg/analysis_server/test/services/correction/fix_test.dart +++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -7377,11 +7377,6 @@ @failingTest @override - test_createConstructorSuperImplicit_private() => - super.test_createConstructorSuperImplicit_private(); - - @failingTest - @override test_createConstructorSuperImplicit_typeArgument() => super.test_createConstructorSuperImplicit_typeArgument();