Skip to content

Commit

Permalink
Fix comment_references in the face of incomplete references (#819)
Browse files Browse the repository at this point in the history
Fixes: #819
  • Loading branch information
pq committed Oct 24, 2017
1 parent d564693 commit b4442ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/rules/comment_references.dart
Expand Up @@ -68,7 +68,7 @@ class Visitor extends SimpleAstVisitor {
rule.lintCode, nameOffset, reference.length);
}
}
leftIndex = comment.indexOf('[', rightIndex);
leftIndex = rightIndex < 0 ? -1 : comment.indexOf('[', rightIndex);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/rules/comment_references.dart
Expand Up @@ -24,3 +24,9 @@ class A {
/// Writes [y]. #LINT
void write(int x) {}
}

/// [
/// ^--- Should not crash (#819).
class B {

}

0 comments on commit b4442ee

Please sign in to comment.