Skip to content

Commit

Permalink
Avoid division by zero in grapheme_position
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jan 11, 2024
1 parent 9c50a7e commit 3d88ceb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion graphics/src/text/paragraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl core::text::Paragraph for Paragraph {
glyph.w
* (1.0
- graphemes_seen.saturating_sub(index) as f32
/ last_grapheme_count as f32)
/ last_grapheme_count.max(1) as f32)
};

Some(Point::new(
Expand Down

0 comments on commit 3d88ceb

Please sign in to comment.