Skip to content

Commit

Permalink
Fixes crash on empty rust file. (#592)
Browse files Browse the repository at this point in the history
Fixes #591

Co-authored-by: Cor Peters <[email protected]>
  • Loading branch information
luctius and Cor Peters authored Aug 16, 2021
1 parent 7892349 commit ac3c171
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-core/src/match_brackets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn find(syntax: &Syntax, doc: &Rope, pos: usize) -> Option<usize> {

let len = doc.len_bytes();
let start_byte = node.start_byte();
let end_byte = node.end_byte() - 1; // it's end exclusive
let end_byte = node.end_byte().saturating_sub(1); // it's end exclusive
if start_byte >= len || end_byte >= len {
return None;
}
Expand Down

0 comments on commit ac3c171

Please sign in to comment.