Fix panic when grid widget is empty
This commit is contained in:
parent
3997291f31
commit
6fe7c2bdd5
1 changed files with 8 additions and 0 deletions
|
|
@ -192,6 +192,14 @@ where
|
|||
Constraint::Amount(amount) => amount,
|
||||
};
|
||||
|
||||
if self.children.is_empty() || cells_per_row == 0 {
|
||||
return layout::Node::new(limits.resolve(
|
||||
size.width,
|
||||
size.height,
|
||||
Size::ZERO,
|
||||
));
|
||||
}
|
||||
|
||||
let cell_width = (available.width
|
||||
- self.spacing * (cells_per_row - 1) as f32)
|
||||
/ cells_per_row as f32;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue