@@ -7,6 +7,10 @@ pub fn find_nth_next(
8 inclusive: bool,
8 inclusive: bool,
9) -> Option<usize> {
9) -> Option<usize> {
10+ if pos >= text.len_chars() {
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);