13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Bjarne Koll 2024-05-12 17:41:21 +02:00
Ursprung cde6cb4f28
Commit def79f079d

Datei anzeigen

@ -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;
+ }
+