Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 398513002: Fix for NPE if subscribing for errors in a not analyzed file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 8976a09054ac222643f9845129557431737c6a24..975a91157099cc814ebc83ba2425f504042611bc 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -470,12 +470,18 @@ class AnalysisServer {
Set<String> todoFiles = oldFiles != null ? newFiles.difference(oldFiles) : newFiles;
for (String file in todoFiles) {
Source source = getSource(file);
+ // prepare context
AnalysisContext context = getAnalysisContext(file);
+ if (context == null) {
+ continue;
+ }
// errors
if (service == AnalysisService.ERRORS) {
LineInfo lineInfo = context.getLineInfo(source);
- List<AnalysisError> errors = context.getErrors(source).errors;
- sendAnalysisNotificationErrors(this, file, lineInfo, errors);
+ if (lineInfo != null) {
+ List<AnalysisError> errors = context.getErrors(source).errors;
+ sendAnalysisNotificationErrors(this, file, lineInfo, errors);
+ }
}
// Dart unit notifications.
if (AnalysisEngine.isDartFileName(file)) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698