Skip to content

Conversation

@AdvanceControl
Copy link
Contributor

@AdvanceControl AdvanceControl commented Nov 3, 2025

Fixes #112304
The editor would crash due to a null pointer dereference in EditorHelp::_add_type_icon when trying to display the help page for a class that does not have a registered icon (e.g., internal types like @GlobalScope).

This PR adds null check to EditorHelp::_add_type_icon

@takethebait
Copy link

Ran into this just now. This does fix the issue for me. Happend when Ctrl + clicking on preload in a script.

void EditorHelp::_add_type_icon(const String &p_type, int p_size, const String &p_fallback) {
Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(p_type, p_fallback);
if (icon.is_null()) {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return;
icon = EditorNode::get_singleton()->get_class_icon("Object");
ERR_FAIL_NULL(icon);

To match behavior to be the as before the change that introduced the crash (fallback to default Object "cube" icon).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be ERR_FAIL_COND(icon.is_null()); in this case, you can't use ERR_FAIL_NULL here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not having an icon will leave an empty space (two spaces around the missing icon), so having it will make help page look more consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The crash is caused by @GDScript and @GlobalScope lacking an icon. Therefore, if we want to handle this error at this stage, we have two options: either implement special handling for these internal names, or assign them a fallback icon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we should fallback to Object again, like before. I'll amend this so we can merge for 4.6-dev3.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there's no consensus about the icon, it's fine to keep it as is, since it is fixing the crash. We can decide which icon to use/not use later.

@Repiteo Repiteo merged commit 76b44eb into godotengine:master Nov 3, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 3, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when opening help page probably caused by it failing to find the icon

6 participants