on master help sign in
f/t: Check if at bounds before searching, refs #43, closes #37
0851110Blaž Hrastnik
helix-core/src/search.rs+4
@@ -7,6 +7,10 @@ pub fn find_nth_next(
7 n: usize,
7 n: usize,
8 inclusive: bool,
8 inclusive: bool,
9) -> Option<usize> {
9) -> Option<usize> {
10+ if pos >= text.len_chars() {
11+ return None;
12+ }
13+
10 // start searching right after pos
14 // start searching right after pos
11 let mut chars = text.chars_at(pos + 1);
15 let mut chars = text.chars_at(pos + 1);
12
16