diff options
author | George Marques <george@gmarqu.es> | 2021-09-17 14:31:51 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-09-17 14:31:51 -0300 |
commit | 651319de11d0c3c4b3278b846b77cb3d034beae3 (patch) | |
tree | 92d706014f1fcd7852f229540c41c4b35a30fcb1 /modules/gdscript/gdscript_parser.cpp | |
parent | b8fdeb64678444103a9b6c96ef3ae2c65ad02b2f (diff) | |
download | redot-engine-651319de11d0c3c4b3278b846b77cb3d034beae3.tar.gz |
GDScript: Properly catch error when missing index in subscript
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index b443e43846..c901d9f68f 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -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.)"); |