Merge pull request #52063 from KoBeWi/double_comma_of_doom

Fix crash with consecutive commas in Dictionary
This commit is contained in:
George Marques 2021-09-10 11:24:51 -03:00 committed by GitHub
commit 6423e891a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -2464,8 +2464,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)) {

View file

@ -0,0 +1,2 @@
func test():
var dictionary = { hello = "world",, }

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected expression as dictionary key.