1
0
Fork 0

Merge pull request #102892 from Chaosus/shader_fix_varying_increment_crash

Fix crash at using increment op for varying in `light` shader function
This commit is contained in:
Rémi Verschelde 2025-02-15 23:09:59 +01:00
commit 4638f3da62
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 7 additions and 4 deletions

View File

@ -7276,8 +7276,9 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
return nullptr;
}
if (!_validate_assign(expr, p_function_info)) {
_set_error(RTR("Invalid use of increment/decrement operator in a constant expression."));
String error;
if (!_validate_assign(expr, p_function_info, &error)) {
_set_error(error);
return nullptr;
}
expr = op;
@ -7611,8 +7612,10 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
for (int i = expr_pos - 1; i >= next_op; i--) {
OperatorNode *op = alloc_node<OperatorNode>();
op->op = expression[i].op;
if ((op->op == OP_INCREMENT || op->op == OP_DECREMENT) && !_validate_assign(expression[i + 1].node, p_function_info)) {
_set_error(RTR("Invalid use of increment/decrement operator in a constant expression."));
String error;
if ((op->op == OP_INCREMENT || op->op == OP_DECREMENT) && !_validate_assign(expression[i + 1].node, p_function_info, &error)) {
_set_error(error);
return nullptr;
}
op->arguments.push_back(expression[i + 1].node);