Skip to content

Commit

Permalink
AnchorLayout: if no items are processed in the loop, consider it a ci…
Browse files Browse the repository at this point in the history
…rcular reference (closes #184)

An exception was already thrown, but now it is more specific
  • Loading branch information
joshtynjala committed Jul 24, 2024
1 parent fcb524d commit 7b18eae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/feathers/layout/AnchorLayout.hx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ class AnchorLayout extends EventDispatcher implements ILayout {
doneItems.push(item);
}
if (oldDoneCount == doneItems.length) {
throw new IllegalOperationError("AnchorLayout failed.");
// if no additional items were processed,
// it's probably a circular reference
throw new IllegalOperationError("relativeTo circular reference detected");
}
}
var viewPortWidth = 0.0;
Expand Down Expand Up @@ -368,7 +370,9 @@ class AnchorLayout extends EventDispatcher implements ILayout {
doneItems.push(item);
}
if (!needsAnotherPass && oldDoneCount == doneItems.length) {
throw new IllegalOperationError("AnchorLayout failed.");
// if no additional items were processed,
// it's probably a circular reference
throw new IllegalOperationError("relativeTo circular reference detected");
}
}
if (needsAnotherPass) {
Expand Down

0 comments on commit 7b18eae

Please sign in to comment.