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 39f96e73dcaf0b93c94927ac57fbe28b75bb913a..1a99f8fa905819498be3a5fbcdf9c29feeb1cb3f 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
@@ -139,6 +139,12 @@ class FixProcessor { |
String get eol => utils.endOfLine; |
Future<List<Fix>> compute() async { |
+ // If the source was changed between the constructor and running |
+ // this asynchronous method, it is not safe to use the unit. |
+ if (context.getModificationStamp(unitSource) != fileStamp) { |
+ return const <Fix>[]; |
+ } |
+ |
try { |
utils = new CorrectionUtils(unit); |
} catch (e) { |