-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix blend_node
crash with invalid AnimationNode reference
#86321
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the null check in the first line of _blend_node()
could be removed, as it would be a duplicate check. If so, does it cause a problem that there is no check on the call within blend_input()
?
Reading the code, it looks like the provided |
47b7c8c
to
a2eb91f
Compare
|
blend_node
crash with invalid p_nodeblend_node
crash with invalid AnimationNode reference
I'm not 100% sure about the logic here. But like I said earlier, from the code, the other places calling But there's no harm in adding more checkes I guess, or just keep the check inside |
I prefer to add more two checks to animation_tree.cpp line 167: Ref<AnimationNode> node = blend_tree->get_node(node_name);
ERR_FAIL_COND_V (node.is_null(), NodeTimeInfo());
real_t activity = 0.0;
Vector<AnimationTree::Activity> *activity_ptr = process_state->tree->input_activity_map.getptr(node_state.base_path);
NodeTimeInfo nti = _blend_node(node, node_name, nullptr, p_playback_info, p_filter, p_sync, p_test_only, &activity);
if (activity_ptr && p_input < activity_ptr->size()) {
activity_ptr->write[p_input].last_pass = process_state->last_pass;
activity_ptr->write[p_input].activity = activity;
}
return nti; animation_blend_tree.cpp line 1635: AnimationNode::NodeTimeInfo AnimationNodeBlendTree::_process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) {
Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output].node;
node_state.connections = nodes[SceneStringNames::get_singleton()->output].connections;
ERR_FAIL_COND_V (output.is_null(), NodeTimeInfo());
AnimationMixer::PlaybackInfo pi = p_playback_info;
pi.weight = 1.0;
return _blend_node(output, "output", this, pi, FILTER_IGNORE, true, p_test_only, nullptr);
} |
a2eb91f
to
65c8af5
Compare
Thanks! |
Fixes #86070
It's a regression because 5acf6b4 changed
node_state.connections.clear()
top_node->node_state.connections.clear()
, previously the crash can be prevented by null check in_blend_node
.