Skip to content

Commit

Permalink
prevent arrayfields from tripping circular reference error since they…
Browse files Browse the repository at this point in the history
… can be size 0
  • Loading branch information
mibewh committed Nov 2, 2020
1 parent 37966a7 commit 0a280ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/js/fields/basic/ArrayField.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,12 @@
{
if (schemaReferenceId)
{
if ((fieldChain[i].schema.id === schemaReferenceId) || (fieldChain[i].schema.id === "#" + schemaReferenceId))
if (fieldChain[i]["type"] === "array")
{
// we found an array field, which is ok to be circular since it can be size 0
refCount = 0;
}
else if ((fieldChain[i].schema.id === schemaReferenceId) || (fieldChain[i].schema.id === "#" + schemaReferenceId))
{
refCount++;
}
Expand Down
7 changes: 6 additions & 1 deletion src/js/fields/basic/ObjectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,12 @@
{
if (fieldChain[i].schema)
{
if ( (fieldChain[i].schema.id === propertyReferenceId) || (fieldChain[i].schema.id === "#" + propertyReferenceId))
if (fieldChain[i]["type"] === "array")
{
// we found an array field, which is ok to be circular since it can be size 0
refCount = 0;
}
else if ( (fieldChain[i].schema.id === propertyReferenceId) || (fieldChain[i].schema.id === "#" + propertyReferenceId))
{
refCount++;
}
Expand Down

0 comments on commit 0a280ab

Please sign in to comment.