Skip to content

Commit d042763

Browse files
committed
Fix shader compiler crash when parsing case labels with non-existent vars.
1 parent 45fc515 commit d042763

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

servers/rendering/shader_language.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8532,7 +8532,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
85328532
DataType data_type;
85338533
bool is_const;
85348534

8535-
_find_identifier(p_block, false, p_function_info, tk.text, &data_type, nullptr, &is_const);
8535+
bool found = _find_identifier(p_block, false, p_function_info, tk.text, &data_type, nullptr, &is_const);
8536+
if (!found) {
8537+
_set_error(vformat(RTR("Undefined identifier '%s' in a case label."), String(tk.text)));
8538+
return ERR_PARSE_ERROR;
8539+
}
85368540
if (is_const && data_type == p_block->expected_type) {
85378541
correct_constant_expression = true;
85388542
}

0 commit comments

Comments
 (0)