From 1c460b6dc0863b85fbe931c6524cc7e11946defe Mon Sep 17 00:00:00 2001 From: Andrew Farkas <6060305+HactarCE@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:17:59 -0400 Subject: [PATCH] Skip zero-length layout job sections (#7430) Fixes #7378 Includes a regression test that previously failed and now succeeds. * [x] I have followed the instructions in the PR template --------- Co-authored-by: Emil Ernerfeldt Co-authored-by: Lucas Meurer --- crates/epaint/src/text/fonts.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index f0d1c9c3..f9c1f4f8 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -930,7 +930,7 @@ impl GalleyCache { } else { // Section range overlaps with paragraph range debug_assert!( - section_range.start < section_range.end, + section_range.start <= section_range.end, "Bad byte_range: {section_range:?}" ); let new_range = section_range.start.saturating_sub(start) @@ -1162,6 +1162,13 @@ mod tests { job }, + { + // Regression test for + let mut job = LayoutJob::default(); + job.append("\n", 0.0, TextFormat::default()); + job.append("", 0.0, TextFormat::default()); + job + }, ] }