From 79bf1ab688265e3cbad17012fba6590f072f3ef0 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Wed, 1 Apr 2026 19:39:12 -0700 Subject: [PATCH] Fix preprocessor crash when document nodes have outdated input counts --- node-graph/preprocessor/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/node-graph/preprocessor/src/lib.rs b/node-graph/preprocessor/src/lib.rs index 0f9bf398..f17760e6 100644 --- a/node-graph/preprocessor/src/lib.rs +++ b/node-graph/preprocessor/src/lib.rs @@ -19,6 +19,13 @@ pub fn expand_network(network: &mut NodeNetwork, substitutions: &HashMap expand_network(node_network, substitutions), DocumentNodeImplementation::ProtoNode(proto_node_identifier) => { if let Some(new_node) = substitutions.get(proto_node_identifier) { + // Reconcile the document node's inputs with what the current node definition expects, + // since the saved document may have fewer or more inputs than the current version + while node.inputs.len() < new_node.inputs.len() { + node.inputs.push(new_node.inputs[node.inputs.len()].clone()); + } + node.inputs.truncate(new_node.inputs.len()); + node.implementation = new_node.implementation.clone(); } } @@ -59,6 +66,7 @@ pub fn generate_node_substitutions() -> HashMap = node_io_types .iter() + .take(input_count) .enumerate() .map(|(i, inputs)| { (