diff options
| author | wznmickey <first@wznmickey.com> | 2024-11-05 03:27:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-05 08:27:25 +0000 |
| commit | ada30cd5b14d97ac5b0bc4893b5bce797b53a3e9 (patch) | |
| tree | a7b91b1ff22c1fae2d12af0da936e991bd7ceb2f /crates | |
| parent | 5b11db0ef2b946122e2221ec9818074ab2efab7c (diff) | |
Fix unstoppable empty footnote loop (#5354) (#5364)
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/typst-layout/src/flow/compose.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/typst-layout/src/flow/compose.rs b/crates/typst-layout/src/flow/compose.rs index 932ccc9a..d49c3fc3 100644 --- a/crates/typst-layout/src/flow/compose.rs +++ b/crates/typst-layout/src/flow/compose.rs @@ -431,6 +431,9 @@ impl<'a, 'b> Composer<'a, 'b, '_, '_> { // Find nested footnotes in the entry. let nested = find_in_frames::<FootnoteElem>(&frames); + // Check if there are any non-empty frames. + let exist_non_empty_frame = frames.iter().any(|f| !f.is_empty()); + // Extract the first frame. let mut iter = frames.into_iter(); let first = iter.next().unwrap(); @@ -440,7 +443,7 @@ impl<'a, 'b> Composer<'a, 'b, '_, '_> { // possible, we then migrate the origin frame to the next region to // uphold the footnote invariant (that marker and entry are on the same // page). If not, we just queue the footnote for the next page. - if first.is_empty() { + if first.is_empty() && exist_non_empty_frame { if migratable { return Err(Stop::Finish(false)); } else { |
