Skip to content

Commit 6c082b0

Browse files
committed
0.32
bug fix
1 parent 3e58d39 commit 6c082b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/xenoamess/x8l/TreeNode.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ public TreeNode changeParent(ContentNode contentNode) {
5353

5454
public TreeNode changeParentAndRegister(ContentNode contentNode, int index) {
5555
this.changeParent(contentNode);
56-
this.parent.children.add(index, this);
56+
if (index == -1) {
57+
this.parent.children.add(this);
58+
} else {
59+
this.parent.children.add(index, this);
60+
}
5761
return this;
5862
}
5963

6064
public TreeNode changeParentAndRegister(ContentNode contentNode) {
61-
return this.changeParentAndRegister(contentNode, this.parent.children.size());
65+
return this.changeParentAndRegister(contentNode, -1);
6266
}
6367

6468
public abstract void output(Writer writer);

0 commit comments

Comments
 (0)