Skip to content

Commit

Permalink
Merge pull request #97481 from Chaosus/shader_fix_void_return
Browse files Browse the repository at this point in the history
Fix shader crash when return a void function call
  • Loading branch information
akien-mga committed Sep 26, 2024
2 parents 8493a39 + 3828d45 commit b64b464
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions servers/rendering/shader_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8476,6 +8476,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
return ERR_PARSE_ERROR;
}
} else {
if (b->parent_function->return_type == TYPE_VOID) {
_set_error(vformat(RTR("'%s' function cannot return a value."), "void"));
return ERR_PARSE_ERROR;
}

_set_tkpos(pos); //rollback, wants expression

#ifdef DEBUG_ENABLED
Expand Down

0 comments on commit b64b464

Please sign in to comment.