summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2021-08-13 00:19:55 +0200
committerkobewi <kobewi4e@gmail.com>2021-08-13 00:19:55 +0200
commit8a605d227d297ebfac15147912deea6d0d92b6c6 (patch)
treec630c4ba7554ef20e22e236ee4a3b9fed2958f85 /modules
parenta98589a4497bdff15c66a98b6d07241addddae2c (diff)
Prevent crash when awaiting in a getter/setter
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_parser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index a21167ad95..5b67ab3f14 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -2415,7 +2415,9 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_await(ExpressionNode *p_pr
AwaitNode *await = alloc_node<AwaitNode>();
await->to_await = parse_precedence(PREC_AWAIT, false);
- current_function->is_coroutine = true;
+ if (current_function) { // Might be null in a getter or setter.
+ current_function->is_coroutine = true;
+ }
return await;
}