summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-11 08:32:30 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-11 08:32:30 +0100
commit3d88ceb482855549271fe73165eeea4871222048 (patch)
tree98e75e5a8eddccc3fbc64953f019c8d1be9a80ec /graphics
parent9c50a7ed7ee439b658f406da9018c9249ffa0b81 (diff)
downloadiced-3d88ceb482855549271fe73165eeea4871222048.tar.gz
iced-3d88ceb482855549271fe73165eeea4871222048.tar.bz2
iced-3d88ceb482855549271fe73165eeea4871222048.zip
Avoid division by zero in `grapheme_position`
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/text/paragraph.rs2
1 files changed, 1 insertions, 1 deletions
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(