From e8dd842c6699c665225c03e904a40887f8424e30 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 13 Apr 2022 11:59:05 +0200 Subject: Fix bug with basically empty paragraph --- src/library/text/par.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/library') diff --git a/src/library/text/par.rs b/src/library/text/par.rs index d740df03..cf7dc4a9 100644 --- a/src/library/text/par.rs +++ b/src/library/text/par.rs @@ -824,6 +824,19 @@ fn line<'a>( mandatory: bool, hyphen: bool, ) -> Line<'a> { + if range.is_empty() { + return Line { + bidi: &p.bidi, + range, + first: None, + items: &[], + last: None, + width: Length::zero(), + mandatory, + dash: false, + }; + } + // Find the last item. let (last_idx, last_offset) = p.find_idx_and_offset(range.end.saturating_sub(1)).unwrap(); -- cgit v1.2.3