From 29270b5f3ee625f6b5ab9c97f70705f267c9e2d7 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Mon, 18 Sep 2023 09:55:50 +0200 Subject: [PATCH] fix "can't read origin of undefined" - fixes #417 --- src/structs/Item.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/structs/Item.js b/src/structs/Item.js index 7e1bc92c..c14778b3 100644 --- a/src/structs/Item.js +++ b/src/structs/Item.js @@ -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