fix crash on empty group in rule output
This commit is contained in:
parent
4d61184edd
commit
17e8291281
1 changed files with 5 additions and 3 deletions
|
@ -411,10 +411,12 @@ impl Dish {
|
||||||
}
|
}
|
||||||
RuleCellTo::GroupRandom(group_id) => {
|
RuleCellTo::GroupRandom(group_id) => {
|
||||||
let group = &self.cell_groups[group_id];
|
let group = &self.cell_groups[group_id];
|
||||||
|
if !group.cells.is_empty() {
|
||||||
let i = random::<usize>() % group.cells.len();
|
let i = random::<usize>() % group.cells.len();
|
||||||
let cell = group.cells[i];
|
let cell = group.cells[i];
|
||||||
self.set_cell(px, py, cell);
|
self.set_cell(px, py, cell);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
RuleCellTo::Copy(x, y) => {
|
RuleCellTo::Copy(x, y) => {
|
||||||
let cell = old_state[x + y * variant.width];
|
let cell = old_state[x + y * variant.width];
|
||||||
if let Some(cell) = cell {
|
if let Some(cell) = cell {
|
||||||
|
|
Loading…
Reference in a new issue