We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e58d39 commit 6c082b0Copy full SHA for 6c082b0
src/main/java/com/xenoamess/x8l/TreeNode.java
@@ -53,12 +53,16 @@ public TreeNode changeParent(ContentNode contentNode) {
53
54
public TreeNode changeParentAndRegister(ContentNode contentNode, int index) {
55
this.changeParent(contentNode);
56
- this.parent.children.add(index, this);
+ if (index == -1) {
57
+ this.parent.children.add(this);
58
+ } else {
59
+ this.parent.children.add(index, this);
60
+ }
61
return this;
62
}
63
64
public TreeNode changeParentAndRegister(ContentNode contentNode) {
- return this.changeParentAndRegister(contentNode, this.parent.children.size());
65
+ return this.changeParentAndRegister(contentNode, -1);
66
67
68
public abstract void output(Writer writer);
0 commit comments