diff --git a/helix-core/src/search.rs b/helix-core/src/search.rs index af754ab7..55f7bf1d 100644 --- a/helix-core/src/search.rs +++ b/helix-core/src/search.rs @@ -7,6 +7,10 @@ pub fn find_nth_next( n: usize, inclusive: bool, ) -> Option { + if pos >= text.len_chars() { + return None; + } + // start searching right after pos let mut chars = text.chars_at(pos + 1);