Skip to content

Commit

Permalink
Fix crash in "Goto Definition"
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed Oct 7, 2019
1 parent 1731015 commit 4d4dedf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/definition/bibtex_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ impl BibtexStringDefinitionProvider {
fn find_reference(tree: &BibtexSyntaxTree, position: Position) -> Option<&BibtexToken> {
let mut nodes = tree.find(position);
nodes.reverse();
match (&nodes[0], &nodes[1]) {
(BibtexNode::Word(word), BibtexNode::Field(_))
| (BibtexNode::Word(word), BibtexNode::Concat(_)) => Some(&word.token),
match (&nodes[0], &nodes.get(1)) {
(BibtexNode::Word(word), Some(BibtexNode::Field(_)))
| (BibtexNode::Word(word), Some(BibtexNode::Concat(_))) => Some(&word.token),
_ => None,
}
}
Expand Down

0 comments on commit 4d4dedf

Please sign in to comment.