summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2021-08-24 13:19:40 +0200
committerkobewi <kobewi4e@gmail.com>2021-09-10 15:38:24 +0200
commitc7452a9940d98351d235aa7c559ea54ec82b5c74 (patch)
tree9cce2f9892867d8b6f6a416f80ce3eb3ed7df049 /modules/gdscript/gdscript_parser.cpp
parent1234c2bdd9fcac46e66af8532920d9b40776cf37 (diff)
downloadredot-engine-c7452a9940d98351d235aa7c559ea54ec82b5c74.tar.gz
Fix crash with consecutive commas in Dictionary
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 4f275ca240..25083a1f0a 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -2462,8 +2462,10 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_dictionary(ExpressionNode
push_error(R"(Expected "=" after dictionary key.)");
}
}
- key->is_constant = true;
- key->reduced_value = static_cast<IdentifierNode *>(key)->name;
+ if (key != nullptr) {
+ key->is_constant = true;
+ key->reduced_value = static_cast<IdentifierNode *>(key)->name;
+ }
break;
case DictionaryNode::PYTHON_DICT:
if (!match(GDScriptTokenizer::Token::COLON)) {