Skip to content

Commit

Permalink
Fixes crash on empty rust file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cor Peters committed Aug 16, 2021
1 parent 7892349 commit 39be30d
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 39be30d

Please sign in to comment.