Prevent shader crash when returning array when return type is scalar
This commit is contained in:
parent
aa251c310a
commit
eec82d9f75
1 changed files with 1 additions and 7 deletions
|
@ -6375,13 +6375,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
|||
}
|
||||
pass_array = false;
|
||||
|
||||
bool array_size_incorrect = false;
|
||||
|
||||
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()) {
|
||||
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()) {
|
||||
_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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue