f/t: Check if at bounds before searching, refs #43, closes #37
commit0851110d10d19f34deb7945d19576e20d7a9d29b
authorBlaž Hrastnik <blaz@mxxn.io>
dateWed 2 Jun 2021, 13:14 (5 years ago)
parent3ace581
helix-core/src/search.rs+4
@@ -7,6 +7,10 @@ pub fn find_nth_next(
77 n: usize,
88 inclusive: bool,
99) -> Option<usize> {
10+ if pos >= text.len_chars() {
11+ return None;
12+ }
13+
1014 // start searching right after pos
1115 let mut chars = text.chars_at(pos + 1);
1216