fix "can't read origin of undefined" - fixes #417

This commit is contained in:
Kevin Jahns 2023-09-18 09:55:50 +02:00
parent a099e98bd6
commit 29270b5f3e

View File

@ -389,9 +389,8 @@ export class Item extends AbstractStruct {
}
if ((this.left && this.left.constructor === GC) || (this.right && this.right.constructor === GC)) {
this.parent = null
}
// only set parent if this shouldn't be garbage collected
if (!this.parent) {
} else if (!this.parent) {
// only set parent if this shouldn't be garbage collected
if (this.left && this.left.constructor === Item) {
this.parent = this.left.parent
this.parentSub = this.left.parentSub