From 4d4dedf8e01bfafbb27ebe3c086f3ec7764db4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20F=C3=B6rster?= Date: Mon, 7 Oct 2019 21:30:32 +0200 Subject: [PATCH] Fix crash in "Goto Definition" --- src/definition/bibtex_string.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/definition/bibtex_string.rs b/src/definition/bibtex_string.rs index 06f416a36..0e4f64315 100644 --- a/src/definition/bibtex_string.rs +++ b/src/definition/bibtex_string.rs @@ -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, } }