diff --git a/src/AnimGraph/AnimGraphEditor.cc b/src/AnimGraph/AnimGraphEditor.cc index 66f435c..2f297f4 100644 --- a/src/AnimGraph/AnimGraphEditor.cc +++ b/src/AnimGraph/AnimGraphEditor.cc @@ -459,6 +459,7 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { if (input_pin_id && output_pin_id) { int source_node_index; int source_node_socket_index; + const Socket* source_socket = nullptr; OutputPinIdToNodeIndexAndSocketIndex( input_pin_id.Get(), @@ -471,10 +472,17 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { if (source_node->m_socket_accessor->m_outputs.size() < source_node_socket_index) { source_node_socket_index = -1; + } else { + source_socket = + sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex] + ->m_blend_tree_resource.GetNodeOutputSocketByIndex( + source_node, + source_node_socket_index); } int target_node_index; int target_node_socket_index; + const Socket* target_socket = nullptr; InputPinIdToNodeIndexAndSocketIndex( output_pin_id.Get(), @@ -487,19 +495,14 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { if (target_node->m_socket_accessor->m_inputs.size() < target_node_socket_index) { target_node_socket_index = -1; + } else { + target_socket = + sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex] + ->m_blend_tree_resource.GetNodeInputSocketByIndex( + target_node, + target_node_socket_index); } - const Socket* source_socket = - sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex] - ->m_blend_tree_resource.GetNodeOutputSocketByIndex( - source_node, - source_node_socket_index); - const Socket* target_socket = - sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex] - ->m_blend_tree_resource.GetNodeInputSocketByIndex( - target_node, - target_node_socket_index); - if (source_socket == nullptr || target_socket == nullptr || !sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex] ->m_blend_tree_resource.IsConnectionValid(