Skip to content

Commit b64b464

Browse files
committed
Merge pull request godotengine#97481 from Chaosus/shader_fix_void_return
Fix shader crash when return a void function call
2 parents 8493a39 + 3828d45 commit b64b464

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

servers/rendering/shader_language.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8476,6 +8476,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
84768476
return ERR_PARSE_ERROR;
84778477
}
84788478
} else {
8479+
if (b->parent_function->return_type == TYPE_VOID) {
8480+
_set_error(vformat(RTR("'%s' function cannot return a value."), "void"));
8481+
return ERR_PARSE_ERROR;
8482+
}
8483+
84798484
_set_tkpos(pos); //rollback, wants expression
84808485

84818486
#ifdef DEBUG_ENABLED

0 commit comments

Comments
 (0)