summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-08-28 23:01:34 +0200
committerGitHub <noreply@github.com>2021-08-28 23:01:34 +0200
commit4f9509e6ba7703171c6c32a8e1a62ef20eef4822 (patch)
tree05f5e70b513d7a65a8942e0f55e6a26a696c77b0
parent00e66e26ccb89fca19a59a8636fbceb31fc0d4d3 (diff)
parente77338978f9f4186d136773a06a4b5c0177780ee (diff)
Merge pull request #52085 from williamd67/fix-await-without-argument
Print error message when await is not followed by signal or coroutine
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 029e30080b..d202bd4420 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -2380,7 +2380,11 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_assignment(ExpressionNode
GDScriptParser::ExpressionNode *GDScriptParser::parse_await(ExpressionNode *p_previous_operand, bool p_can_assign) {
AwaitNode *await = alloc_node<AwaitNode>();
- await->to_await = parse_precedence(PREC_AWAIT, false);
+ ExpressionNode *element = parse_precedence(PREC_AWAIT, false);
+ if (element == nullptr) {
+ push_error(R"(Expected signal or coroutine after "await".)");
+ }
+ await->to_await = element;
current_function->is_coroutine = true;