mirror of
https://github.com/typst/typst
synced 2025-05-22 04:55:29 +08:00
Fix panic in grid due to empty auto row
This commit is contained in:
parent
2818ceee44
commit
1d60525690
@ -387,13 +387,20 @@ impl<'a> GridLayouter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
// Layout the row.
|
||||
// Nothing to layout.
|
||||
if resolved.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Layout into a single region.
|
||||
if let &[first] = resolved.as_slice() {
|
||||
let frame = self.layout_single_row(ctx, first, y);
|
||||
self.push_row(ctx, frame);
|
||||
} else {
|
||||
// Expand all but the last region if the space is not eaten up by any fr
|
||||
// rows.
|
||||
return;
|
||||
}
|
||||
|
||||
// Expand all but the last region if the space is not
|
||||
// eaten up by any fr rows.
|
||||
if self.fr.is_zero() {
|
||||
let len = resolved.len();
|
||||
for (target, (current, _)) in
|
||||
@ -403,6 +410,7 @@ impl<'a> GridLayouter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
// Layout into multiple regions.
|
||||
let frames = self.layout_multi_row(ctx, &resolved, y);
|
||||
let len = frames.len();
|
||||
for (i, frame) in frames.into_iter().enumerate() {
|
||||
@ -412,7 +420,6 @@ impl<'a> GridLayouter<'a> {
|
||||
self.push_row(ctx, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Layout a row with a fixed size along the block axis.
|
||||
fn layout_single_row(
|
||||
|
Loading…
x
Reference in New Issue
Block a user