diff options
author | Blaž Hrastnik | 2021-06-02 04:14:55 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-02 04:20:27 +0000 |
commit | 0851110d10d19f34deb7945d19576e20d7a9d29b (patch) | |
tree | f751b6627c2438cd7d4b6c499b889387d1176625 /helix-core | |
parent | 3ace581191e9c23aae23d7aabacd29c6b8ed7f65 (diff) |
f/t: Check if at bounds before searching, refs #43, closes #37
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/search.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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<usize> { + if pos >= text.len_chars() { + return None; + } + // start searching right after pos let mut chars = text.chars_at(pos + 1); |