mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 17:33:33 +00:00
GDScript: Fix crash when base of an attribute is invalid
In attribute expressions (`a.b`) it's possible that the base has an incorrect syntax and thus become a nullptr expression in the tree. This commit add the check for this case to fail gracefully instead of crashing.
This commit is contained in:
parent
c201b212c7
commit
9ed0f0384c
2 changed files with 7 additions and 1 deletions
|
@ -2545,7 +2545,7 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_attribute(ExpressionNode *
|
|||
|
||||
if (for_completion) {
|
||||
bool is_builtin = false;
|
||||
if (p_previous_operand->type == Node::IDENTIFIER) {
|
||||
if (p_previous_operand && p_previous_operand->type == Node::IDENTIFIER) {
|
||||
const IdentifierNode *id = static_cast<const IdentifierNode *>(p_previous_operand);
|
||||
Variant::Type builtin_type = get_builtin_type(id->name);
|
||||
if (builtin_type < Variant::VARIANT_MAX) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue