mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Prevent shader crash if function call been used on constant
This commit is contained in:
parent
09a3d8f5c4
commit
d9087e1b44
@ -4005,6 +4005,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
if (node->is_const && n->type == Node::TYPE_OPERATOR && ((OperatorNode *)n)->op == OP_CALL) {
|
||||
_set_error("Expected constant expression");
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
if (var.type != n->get_datatype()) {
|
||||
_set_error("Invalid assignment of '" + get_datatype_name(n->get_datatype()) + "' to '" + get_datatype_name(var.type) + "'");
|
||||
return ERR_PARSE_ERROR;
|
||||
@ -4065,7 +4070,10 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
|
||||
Node *n = _parse_and_reduce_expression(p_block, p_builtin_types);
|
||||
if (!n)
|
||||
return ERR_PARSE_ERROR;
|
||||
|
||||
if (node->is_const && n->type == Node::TYPE_OPERATOR && ((OperatorNode *)n)->op == OP_CALL) {
|
||||
_set_error("Expected constant expression after '='");
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
decl.initializer = n;
|
||||
|
||||
if (var.type != n->get_datatype()) {
|
||||
|
Loading…
Reference in New Issue
Block a user