summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-15 21:35:42 +0200
committerGitHub <noreply@github.com>2021-10-15 21:35:42 +0200
commit08d1ce718d5d1845c163f016b4083210136c1248 (patch)
tree8b6a2667c6cc58797b3e3de6b893a5485d1cbbce /modules
parent9988c28edd77fba6e870280c047ae0d5128350e0 (diff)
parentb0725a3b7dff7a0cac337b9fb2c1fedcf3261dd5 (diff)
Merge pull request #53856 from vnen/gdscript-setter-crash
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_parser.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 40be5cb324..7ddb9b93b4 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -967,15 +967,17 @@ void GDScriptParser::parse_property_setter(VariableNode *p_variable) {
ParameterNode *parameter = alloc_node<ParameterNode>();
parameter->identifier = p_variable->setter_parameter;
- function->parameters_indices[parameter->identifier->name] = 0;
- function->parameters.push_back(parameter);
+ if (parameter->identifier != nullptr) {
+ function->parameters_indices[parameter->identifier->name] = 0;
+ function->parameters.push_back(parameter);
- SuiteNode *body = alloc_node<SuiteNode>();
- body->add_local(parameter, function);
+ SuiteNode *body = alloc_node<SuiteNode>();
+ body->add_local(parameter, function);
- function->body = parse_suite("setter declaration", body);
+ function->body = parse_suite("setter declaration", body);
+ p_variable->setter = function;
+ }
- p_variable->setter = function;
current_function = previous_function;
break;
}