Skip to content
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

AnimationPlayer: Editor crashes when clicking on "Interpolation Mode" with nonexistent node path #81769

Closed
perry-blueberry opened this issue Sep 16, 2023 · 2 comments · Fixed by #81779

Comments

@perry-blueberry
Copy link

Godot version

4.1.1.stable

System information

Ubuntu 22.04

Issue description

The editor crashes when clicking on "Interpolation Mode" when a path points to a none-existing NodePath. I noticed this issue when I duplicated an AnimationPlayer from one scene to another.

I expect some sort of error message but not a crash.

Steps to reproduce

Create a new project with a simple scene and add an AnimationPlayer as a child node. Change a path (tracks/0/path) to something that doesn't exist. Click on the button for "Interpolation Mode".

Minimal reproduction project

AnimationPlayerCrash.zip

@RealMadvicius
Copy link
Contributor

That should be an easy fix, it is a null point not checked in animation_trackeditor.cpp line 2698 int he function
void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event)
...
Node *nd = ap->get_node(ap->get_root())->get_node(NodePath(npath.get_concatenated_names()));

then we call this line without checking if the node pointer "nd" is not null

ClassDB::get_property_info(nd->get_class(), prop, &prop_info);

@RealMadvicius
Copy link
Contributor

I will read a bit about the coding policy for the godot coding style etc and see if i find some free time to push a fix, then pull request , unless someone else do it first <_<

RealMadvicius added a commit to RealMadvicius/godot that referenced this issue Oct 7, 2023
… path

issue reference [godotengine#81769]
godotengine#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
@akien-mga akien-mga added this to the 4.2 milestone Oct 9, 2023
mandryskowski pushed a commit to mandryskowski/godot that referenced this issue Oct 11, 2023
… path

issue reference [godotengine#81769]
godotengine#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
ProbablyWorks pushed a commit to ProbablyWorks/godot that referenced this issue Oct 22, 2023
… path

issue reference [godotengine#81769]
godotengine#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
YuriSizov pushed a commit to YuriSizov/godot that referenced this issue Jan 23, 2024
… path

issue reference [godotengine#81769]

- 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

(cherry picked from commit e7a35d1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants