Skip to content

Commit

Permalink
f/t: Check if at bounds before searching, refs #43, closes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jun 2, 2021
1 parent 3ace581 commit 0851110
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helix-core/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ pub fn find_nth_next(
n: usize,
inclusive: bool,
) -> Option<usize> {
if pos >= text.len_chars() {
return None;
}

// start searching right after pos
let mut chars = text.chars_at(pos + 1);

Expand Down

0 comments on commit 0851110

Please sign in to comment.