Merge pull request #2304 from aws-lumberyard-dev/scripting/contract_crash_fix

Crash guard when the data has a list with an empty contract
This commit is contained in:
Luis Sempé
2021-07-21 14:48:24 -07:00
committed by GitHub
2 changed files with 11 additions and 3 deletions
@@ -23,6 +23,11 @@ namespace ScriptCanvas
AZStd::string failedContract;
AZStd::all_of(firstSlot.GetContracts().begin(), firstSlot.GetContracts().end(), [&firstSlot, &secondSlot, &outcome](const AZStd::unique_ptr<Contract>& contract)
{
if (!contract)
{
return false;
}
outcome = contract->Evaluate(firstSlot, secondSlot);
if (outcome.IsSuccess())
{
@@ -828,10 +828,13 @@ namespace ScriptCanvas
for (const auto& contract : m_contracts)
{
failureReason = contract->EvaluateForType(dataType);
if (!failureReason)
if (contract)
{
return failureReason;
failureReason = contract->EvaluateForType(dataType);
if (!failureReason)
{
return failureReason;
}
}
}