Fix crash with consecutive commas in Dictionary

This commit is contained in:
kobewi 2021-08-24 13:19:40 +02:00
parent 1234c2bdd9
commit c7452a9940
3 changed files with 8 additions and 2 deletions

View file

@ -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)) {

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.