浏览代码

Prevent crash when awaiting in a getter/setter

kobewi 4 年之前
父节点
当前提交
8a605d227d
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      modules/gdscript/gdscript_parser.cpp

+ 3 - 1
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;
 }