From 3d88ceb482855549271fe73165eeea4871222048 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 11 Jan 2024 08:32:30 +0100 Subject: Avoid division by zero in `grapheme_position` --- graphics/src/text/paragraph.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/src/text/paragraph.rs b/graphics/src/text/paragraph.rs index 56cd8868..5d027542 100644 --- a/graphics/src/text/paragraph.rs +++ b/graphics/src/text/paragraph.rs @@ -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( -- cgit