Fix three layers of safeguards to ensure node doesn't become it's own parent
This commit is contained in:
parent
960c9e2625
commit
edd3d11b09
3 changed files with 143 additions and 7 deletions
|
|
@ -424,6 +424,9 @@ export class Node {
|
|||
return this._parent
|
||||
}//}}}
|
||||
moveToParent(newParentUUID) {// {{{
|
||||
if (this.UUID === newParentUUID)
|
||||
throw new Error("New parent UUID is the same as node UUID. Can't be your own parent.")
|
||||
|
||||
this.ParentUUID = newParentUUID
|
||||
this.data.ParentUUID = newParentUUID
|
||||
this._modified = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue