diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index b400a6e03b2..725c4276180 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -4620,6 +4620,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Mapparent_function && (b->parent_function->name == "vertex" || b->parent_function->name == "fragment" || b->parent_function->name == "light")) { + _set_error(vformat("Using 'return' in '%s' processor function results in undefined behavior!", b->parent_function->name)); + return ERR_PARSE_ERROR; + } + while (b && !b->parent_function) { b = b->parent_block; }