1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

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
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.)"); push_error(R"(Expected "=" after dictionary key.)");
} }
} }
if (key != nullptr) {
key->is_constant = true; key->is_constant = true;
key->reduced_value = static_cast<IdentifierNode *>(key)->name; key->reduced_value = static_cast<IdentifierNode *>(key)->name;
}
break; break;
case DictionaryNode::PYTHON_DICT: case DictionaryNode::PYTHON_DICT:
if (!match(GDScriptTokenizer::Token::COLON)) { 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.