on master help sign in
Fix 'attempt to divide by zero' panic (#6155)
commitddc5bf4e606230dd8bc20c59b1cc114e93bbf1c0 authornuid32 <91177333+nuid32@users.noreply.github.com> dateFri 3 Mar 2023, 11:50 (4 years ago) parent6e7dcb3
1 file changed+1−1
helix-term/src/ui/text.rs+1−1
helix-term/src/ui/text.rs+1−1
@@ -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 }