You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
GDScript: Properly catch error when missing index in subscript
This commit is contained in:
@@ -2592,6 +2592,10 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_subscript(ExpressionNode *
|
||||
subscript->base = p_previous_operand;
|
||||
subscript->index = parse_expression(false);
|
||||
|
||||
if (subscript->index == nullptr) {
|
||||
push_error(R"(Expected expression after "[".)");
|
||||
}
|
||||
|
||||
pop_multiline();
|
||||
consume(GDScriptTokenizer::Token::BRACKET_CLOSE, R"(Expected "]" after subscription index.)");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user