Fix crash in grid layout.
@@ -408,13 +408,14 @@ impl Layout for GridLayout {
let child = ecm.entity_store().children[&entity][index];
let mut cell_position = (0.0, 0.0);
- let mut available_size = *self.children_sizes.borrow().get(&child).unwrap();
-
+ if let Some(available_size) = self.children_sizes.borrow().get(&child) {
+ let mut available_size = *available_size;
// child margin
let c_margin = Margin::get(child, ecm.component_store());
let c_vertical_alignment = VerticalAlignment::get(child, ecm.component_store());
- let c_horizontal_alignment = HorizontalAlignment::get(child, ecm.component_store());
+ let c_horizontal_alignment =
+ HorizontalAlignment::get(child, ecm.component_store());
let has_columns = if let Ok(columns) =
ecm.component_store().borrow_component::<Columns>(entity)
@@ -511,7 +512,7 @@ impl Layout for GridLayout {
),
);
}
-
+ }
if index + 1 < ecm.entity_store().children[&entity].len() {
index += 1;
} else {
