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

Unified Diff: lib/src/linter.dart

Issue 1464173002: Play it safe with null tokens/nodes (#24910). (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Created 5 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/linter.dart
diff --git a/lib/src/linter.dart b/lib/src/linter.dart
index f58b81dba1944b770e0e79591e4acb272148d76c..dad741589ae6ca8fd3476d2525862372a6ff8534 100644
--- a/lib/src/linter.dart
+++ b/lib/src/linter.dart
@@ -262,11 +262,15 @@ abstract class LintRule extends Linter implements Comparable<LintRule> {
AstVisitor getVisitor() => null;
void reportLint(AstNode node) {
- reporter.reportErrorForNode(new _LintCode(name, description), node, []);
+ if (node != null) {
+ reporter.reportErrorForNode(new _LintCode(name, description), node, []);
+ }
}
void reportLintForToken(Token token) {
- reporter.reportErrorForToken(new _LintCode(name, description), token, []);
+ if (token != null) {
+ reporter.reportErrorForToken(new _LintCode(name, description), token, []);
+ }
}
void reportPubLint(PSNode node) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698