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

Fix crash with null callee #41055

Merged
merged 2 commits into from Aug 11, 2020
Merged

Conversation

snichols
Copy link
Contributor

@snichols snichols commented Aug 5, 2020

Issue

This PR fixes #40942. It's also related to #40943.

Summary

Malformed call expressions that create GDScript::CallNode instances with callee == nullptr are possible. An example of such a malformed expression is var crash = ()(1). When these cases happen during editing, the editor crashes.

The PR fixes the bug by:

  1. Adding an accessor GDScript::CallNode::get_callee_type which checks for nullptr and returns Type::NONE in that case.
  2. Refactoring the code, where sensible, to use the new accessor.

Additionally, this PR adds a more descriptive error message when empty grouping expressions are encountered.

@vnen
Copy link
Member

vnen commented Aug 11, 2020

Your commits are not linked to your GitHub account. This is not a problem for merging but if you want it to appear on your GitHub profile you need to either register the email address you used to commit to your account, or amend the commit authorship to use your GitHub email.

@snichols
Copy link
Contributor Author

Your commits are not linked to your GitHub account. This is not a problem for merging but if you want it to appear on your GitHub profile you need to either register the email address you used to commit to your account, or amend the commit authorship to use your GitHub email.

Fixed.

@akien-mga akien-mga merged commit cf05486 into godotengine:master Aug 11, 2020
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged contribution 🎉

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 GDScriptParser::CallNode::callee is nullptr
4 participants