Skip to content

Commit 9486c75

Browse files
committed
Avoid crash in profiling CI action that occurred in this PR, part II
1 parent 9c67045 commit 9486c75

File tree

1 file changed

+7
-0
lines changed
  • node-graph/preprocessor/src

1 file changed

+7
-0
lines changed

node-graph/preprocessor/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ pub fn expand_network(network: &mut NodeNetwork, substitutions: &HashMap<ProtoNo
1919
DocumentNodeImplementation::Network(node_network) => expand_network(node_network, substitutions),
2020
DocumentNodeImplementation::ProtoNode(proto_node_identifier) => {
2121
if let Some(new_node) = substitutions.get(proto_node_identifier) {
22+
// Reconcile the document node's inputs with what the current node definition expects,
23+
// since the saved document may have fewer or more inputs than the current version
24+
while node.inputs.len() < new_node.inputs.len() {
25+
node.inputs.push(new_node.inputs[node.inputs.len()].clone());
26+
}
27+
node.inputs.truncate(new_node.inputs.len());
28+
2229
node.implementation = new_node.implementation.clone();
2330
}
2431
}

0 commit comments

Comments
 (0)