mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 17:28:12 +08:00
Fix crash when reordering layers (#1492)
This commit is contained in:
@@ -525,6 +525,10 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
|
||||
let mut delete_nodes = vec![id];
|
||||
for (_node, id) in self.network.upstream_flow_back_from_nodes(vec![id], true) {
|
||||
// Don't delete the node if other layers depend on it.
|
||||
if self.outwards_links.get(&id).is_some_and(|nodes| nodes.len() > 1) {
|
||||
break;
|
||||
}
|
||||
if self.outwards_links.get(&id).is_some_and(|outwards| outwards.len() == 1) {
|
||||
delete_nodes.push(id);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ impl OriginalTransforms {
|
||||
pub fn update<'a>(&mut self, selected: &'a [LayerNodeIdentifier], document: &'a Document, shape_editor: Option<&'a ShapeState>) {
|
||||
match self {
|
||||
OriginalTransforms::Layer(layer_map) => {
|
||||
layer_map.retain(|layer, _| selected.contains(layer));
|
||||
for &layer in selected {
|
||||
layer_map.entry(layer).or_insert_with(|| document.metadata.upstream_transform(layer.to_node()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user