fix: guarantee progress in find_all_ranges when pattern is shorter than a utf8 sequence
This commit is contained in:
parent
99f9f95dbc
commit
74e7406034
2 changed files with 6 additions and 2 deletions
|
|
@ -212,7 +212,7 @@ const Utf8PartialIterator = struct {
|
|||
return null;
|
||||
}
|
||||
|
||||
const cp_len = utf8ByteSequenceLength(it.bytes[it.end]) catch unreachable;
|
||||
const cp_len = utf8ByteSequenceLength(it.bytes[it.end]) catch return null;
|
||||
if (it.end + cp_len > it.bytes.len) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue