f/t: Check if at bounds before searching, refs #43, closes #37

pull/50/head
Blaž Hrastnik 4 years ago
parent 3ace581191
commit 0851110d10

@ -7,6 +7,10 @@ pub fn find_nth_next(
n: usize, n: usize,
inclusive: bool, inclusive: bool,
) -> Option<usize> { ) -> Option<usize> {
if pos >= text.len_chars() {
return None;
}
// start searching right after pos // start searching right after pos
let mut chars = text.chars_at(pos + 1); let mut chars = text.chars_at(pos + 1);

Loading…
Cancel
Save