Skip to content

Conversation

@dbnicholson
Copy link
Member

When switching to a different scene in the editor, the previous edited scene root will no longer have a parent and you'll see a pile of "Cannot call method 'is_ancestor_of' on a null value." errors from Godot. Unroll the one liner to add the parent null check and use some intermediate variables to remove duplicate method calls. Note that the is_inside_tree() call is dropped since it's redundant to checking if get_tree() returns null.

When switching to a different scene in the editor, the previous edited
scene root will no longer have a parent and you'll see a pile of "Cannot
call method 'is_ancestor_of' on a null value." errors from Godot. Unroll
the one liner to add the parent null check and use some intermediate
variables to remove duplicate method calls. Note that the
is_inside_tree() call is dropped since it's redundant to checking if
get_tree() returns null.
@dbnicholson dbnicholson requested review from manuq and wjt July 27, 2024 15:35
@wjt wjt merged commit 90fad21 into main Jul 28, 2024
@wjt wjt deleted the safer-is-part-of-edited-scene branch July 28, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants