Fix crash when clicking on "Interpolation Mode" with nonexistent node path
issue reference [https://github.com/godotengine/godot/issues/81769] #81769 AnimationPlayer: Editor crashes when clicking on "Interpolation Mode" with nonexistent node path - adding a nullptr check on a Node pointer obtained from get_node(NodePath) in case it is null now we wont execute the next instruction > ClassDB::get_property_info(nd->get_class(), prop, &prop_info); Which then prevents the crash
This commit is contained in:
parent
6916349697
commit
e7a35d1521
|
@ -2695,7 +2695,13 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||
AnimationPlayer *ap = ape->get_player();
|
||||
if (ap) {
|
||||
NodePath npath = animation->track_get_path(track);
|
||||
Node *nd = ap->get_node(ap->get_root_node())->get_node(NodePath(npath.get_concatenated_names()));
|
||||
Node *a_ap_root_node = ap->get_node(ap->get_root_node());
|
||||
Node *nd = nullptr;
|
||||
// We must test that we have a valid a_ap_root_node before trying to access its content to init the nd Node.
|
||||
if (a_ap_root_node) {
|
||||
nd = a_ap_root_node->get_node(NodePath(npath.get_concatenated_names()));
|
||||
}
|
||||
if (nd) {
|
||||
StringName prop = npath.get_concatenated_subnames();
|
||||
PropertyInfo prop_info;
|
||||
ClassDB::get_property_info(nd->get_class(), prop, &prop_info);
|
||||
|
@ -2710,6 +2716,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
menu->reset_size();
|
||||
|
||||
Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
|
||||
|
|
Loading…
Reference in New Issue