Skip to content

Commit 75fb80f

Browse files
nuid64wes-adams
authored andcommitted
Fix 'attempt to divide by zero' panic (helix-editor#6155)
1 parent aa36a23 commit 75fb80f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

helix-term/src/ui/text.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn required_size(text: &tui::text::Text, max_text_width: u16) -> (u16, u16)
5858
let content_width = content.width() as u16;
5959
if content_width > max_text_width {
6060
text_width = max_text_width;
61-
height += content_width / max_text_width;
61+
height += content_width.checked_div(max_text_width).unwrap_or(0);
6262
} else if content_width > text_width {
6363
text_width = content_width;
6464
}

0 commit comments

Comments
 (0)