From 3d88ceb482855549271fe73165eeea4871222048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 11 Jan 2024 08:32:30 +0100 Subject: [PATCH] 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(