Browse Source

add double linked refs only once

Martin Kunz 1 year ago
parent
commit
1dfc1b91ea
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/ua/UABaseNode.ts

+ 4 - 2
src/ua/UABaseNode.ts

@@ -37,9 +37,11 @@ export class UABaseNode implements IToXML{
                 case ReferencyType.HasProperty:
                 case ReferencyType.HasSubtype:
                     if(ref.isForward) {
-                        this.children.push(node);
+                        if(!this.children.includes(node))
+                            this.children.push(node);
                     } else {
-                        node.children.push(this);
+                        if(!node.children.includes(this))
+                            node.children.push(this);
                     }
                     break;
                 }