Fix crash when material/particle function has invalid graph output index
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user