Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix: try panic! if cursor > source.len()

hippietraild79a9ee051d3
diff --git a/harper-core/src/parsers/plain_english.rs b/harper-core/src/parsers/plain_english.rs
index 8f6acd0f5..6c110f29a 100644
--- a/harper-core/src/parsers/plain_english.rs
+++ b/harper-core/src/parsers/plain_english.rs
@@ -15,7 +15,10 @@ impl Parser for PlainEnglish {
let mut tokens = Vec::new();
loop {
- if cursor >= source.len() {
+ if cursor > source.len() {
+ panic!()
+ }
+ if cursor == source.len() {
return tokens;
}