From 57803b11f684fb9a61cfa6b0a51709f2d97f5e9e Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Sun, 8 Dec 2024 21:28:17 +0100 Subject: [PATCH] Fix bug. unboundStacktrace was not always recorded --- Sources/AppBundle/tree/TreeNode.swift | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Sources/AppBundle/tree/TreeNode.swift b/Sources/AppBundle/tree/TreeNode.swift index 0004fec9..6c313803 100644 --- a/Sources/AppBundle/tree/TreeNode.swift +++ b/Sources/AppBundle/tree/TreeNode.swift @@ -97,6 +97,7 @@ class TreeNode: Equatable { let index = _parent._children.remove(element: self) ?? errorT("Can't find child in its parent") check(_parent._mruChildren.remove(self)) self._parent = nil + unboundStacktrace = getStringStacktrace() return BindingData(parent: _parent, adaptiveWeight: adaptiveWeight, index: index) } @@ -114,13 +115,7 @@ class TreeNode: Equatable { @discardableResult func unbindFromParent() -> BindingData { - let bindingData = unbindIfBound() - if let bindingData { - unboundStacktrace = getStringStacktrace() - return bindingData - } else { - error("\(self) is already unbound. The stacktrace where it was unbound:\n\(unboundStacktrace ?? "nil")") - } + unbindIfBound() ?? errorT("\(self) is already unbound. The stacktrace where it was unbound:\n\(unboundStacktrace ?? "nil")") } static func == (lhs: TreeNode, rhs: TreeNode) -> Bool {