Merge pull request #49360 from Chaosus/fix_shader_crash

This commit is contained in:
Yuri Roubinsky 2021-06-07 07:38:14 +03:00 committed by GitHub
commit 34fc33d192
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6375,13 +6375,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
} }
pass_array = false; pass_array = false;
bool array_size_incorrect = false; if (b->parent_function->return_type != expr->get_datatype() || b->parent_function->return_array_size != expr->get_array_size() || return_struct_name != expr->get_datatype_name()) {
if (b->parent_function->return_array_size > 0 && b->parent_function->return_array_size != expr->get_array_size()) {
array_size_incorrect = true;
}
if (b->parent_function->return_type != expr->get_datatype() || array_size_incorrect || return_struct_name != expr->get_datatype_name()) {
_set_error("Expected return with an expression of type '" + (return_struct_name != "" ? return_struct_name : get_datatype_name(b->parent_function->return_type)) + array_size_string + "'"); _set_error("Expected return with an expression of type '" + (return_struct_name != "" ? return_struct_name : get_datatype_name(b->parent_function->return_type)) + array_size_string + "'");
return ERR_PARSE_ERROR; return ERR_PARSE_ERROR;
} }