Skip to content

Commit db6466c

Browse files
committed
fix: unwrap panic in next_boundary()
1 parent 2081c29 commit db6466c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/grapheme.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,10 @@ impl GraphemeCursor {
695695
return Ok(None);
696696
}
697697
let mut iter = chunk[self.offset - chunk_start..].chars();
698-
let mut ch = iter.next().unwrap();
698+
let mut ch = match iter.next() {
699+
Some(ch) => ch,
700+
None => return Err(GraphemeIncomplete::NextChunk),
701+
};
699702
loop {
700703
if self.resuming {
701704
if self.cat_after.is_none() {

0 commit comments

Comments
 (0)