summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-03-17 11:09:57 -0300
committerGeorge Marques <george@gmarqu.es>2021-03-30 08:29:38 -0300
commit3e4ecd9669f1d84689eff48282191d176175d0a5 (patch)
treecc1d49bf75d06f6d99c3b6ad045cd345a8082e3a /modules/gdscript
parent577a17980d160a95652e6d5ecc3e8554f4c2ebad (diff)
GDScript: Show error on invalid initializer expression
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_parser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 8f2771bb3b..1667aa73bd 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -844,6 +844,9 @@ GDScriptParser::VariableNode *GDScriptParser::parse_variable(bool p_allow_proper
if (match(GDScriptTokenizer::Token::EQUAL)) {
// Initializer.
variable->initializer = parse_expression(false);
+ if (variable->initializer == nullptr) {
+ push_error(R"(Expected expression for variable initial value after "=".)");
+ }
variable->assignments++;
}