Fix crash when material/particle function has invalid graph output index

This commit is contained in:
2026-10-01 15:16:44 +02:00
parent 5f726dc00a
commit aac6a3a4b8
2 changed files with 2 additions and 2 deletions
@@ -461,7 +461,7 @@ void ParticleEmitterGPUGenerator::ProcessGroupParticles(Box* box, Node* node, Va
// Peek the function output (function->Outputs maps the functions outputs to output nodes indices)
const int32 outputIndex = box->ID - 16;
if (outputIndex < 0 || outputIndex >= function->Outputs.Count())
if (!function->Outputs.IsValidIndex(outputIndex) || !graph->Nodes.IsValidIndex(function->Outputs[outputIndex]))
{
OnError(node, box, TEXT("Invalid function output box."));
value = Value::Zero;
@@ -323,7 +323,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
// Peek the function output (function->Outputs maps the functions outputs to output nodes indices)
const int32 outputIndex = box->ID - 16;
if (outputIndex < 0 || outputIndex >= function->Outputs.Count())
if (!function->Outputs.IsValidIndex(outputIndex) || !graph->Nodes.IsValidIndex(function->Outputs[outputIndex]))
{
OnError(node, box, TEXT("Invalid function output box."));
value = Value::Zero;