vkd3d-shader/hlsl: Avoid assuming that expressions have at least one argument.

This commit is contained in:
Zebediah Figura
2021-09-10 16:35:54 -05:00
committed by Alexandre Julliard
parent 22a1a478ea
commit 30550c0831
Notes: Alexandre Julliard 2023-01-13 22:23:38 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/47
2 changed files with 11 additions and 7 deletions

View File

@@ -509,6 +509,8 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (instr->type != HLSL_IR_EXPR)
return false;
expr = hlsl_ir_expr(instr);
if (!expr->operands[0].node)
return false;
if (instr->data_type->type > HLSL_CLASS_VECTOR)
return false;