From 3828d45e31697e2d6b8d411fbca310b7f57cbe35 Mon Sep 17 00:00:00 2001 From: Chaosus Date: Thu, 26 Sep 2024 11:20:39 +0300 Subject: [PATCH] Fix shader crash when return a void function call --- servers/rendering/shader_language.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 14bd3841dfa..879a83f5198 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -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