aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornuid322023-03-03 06:50:26 +0000
committerGitHub2023-03-03 06:50:26 +0000
commitddc5bf4e606230dd8bc20c59b1cc114e93bbf1c0 (patch)
tree2d523e143b1f30e94d4bb7d883b77aab3327f10d
parent6e7dcb33170e50088de6734a046480917a386049 (diff)
Fix 'attempt to divide by zero' panic (#6155)
-rw-r--r--helix-term/src/ui/text.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/ui/text.rs b/helix-term/src/ui/text.rs
index c318052b..a379536f 100644
--- a/helix-term/src/ui/text.rs
+++ b/helix-term/src/ui/text.rs
@@ -58,7 +58,7 @@ pub fn required_size(text: &tui::text::Text, max_text_width: u16) -> (u16, u16)
let content_width = content.width() as u16;
if content_width > max_text_width {
text_width = max_text_width;
- height += content_width / max_text_width;
+ height += content_width.checked_div(max_text_width).unwrap_or(0);
} else if content_width > text_width {
text_width = content_width;
}