Index: pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
index 75d52f191d4df158d6f85fd2d3e54a5cec566e8a..989968174a3023da781e5f66ea40df12f0074ea2 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
@@ -87,6 +87,12 @@ class AssistProcessor { |
String get eol => utils.endOfLine; |
Future<List<Assist>> compute() async { |
+ // If the source was changed between the constructor and running |
+ // this asynchronous method, it is not safe to use the unit. |
+ if (analysisContext.getModificationStamp(source) != fileStamp) { |
+ return const <Assist>[]; |
+ } |
+ |
try { |
utils = new CorrectionUtils(unit); |
} catch (e) { |