mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-16 18:31:53 +01:00
Prevent infinite recursion on cyclic brig redirect (#10705)
Prevent infinite recursion when declaring a cyclic relation between command nodes via child nodes redirecting to an nth parent by marking a command node as unwrapped before unwrapping its children.
This commit is contained in:
parent
cde6cb4f28
commit
def79f079d
1 changed files with 4 additions and 3 deletions
|
@ -401,6 +401,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ throw new IllegalArgumentException("Unknown command node passed. Don't know how to unwrap this.");
|
||||
+ }
|
||||
+
|
||||
+ // Store unwrapped node before unwrapping children to avoid infinite recursion in cyclic redirects.
|
||||
+ converted.wrappedCached = pureNode;
|
||||
+ pureNode.unwrappedCached = converted;
|
||||
+
|
||||
+ /*
|
||||
+ Add the children to the node, unwrapping each child in the process.
|
||||
+ */
|
||||
|
@ -408,9 +412,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ converted.addChild(this.unwrapNode(child));
|
||||
+ }
|
||||
+
|
||||
+ converted.wrappedCached = pureNode;
|
||||
+ pureNode.unwrappedCached = converted;
|
||||
+
|
||||
+ return converted;
|
||||
+ }
|
||||
+
|
||||
|
|
Loading…
Add table
Reference in a new issue