Fix three layers of safeguards to ensure node doesn't become it's own parent

This commit is contained in:
Magnus Åhall 2026-06-15 16:39:56 +02:00
parent 960c9e2625
commit edd3d11b09
3 changed files with 143 additions and 7 deletions

View file

@ -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