summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starling/node.scm17
1 files changed, 8 insertions, 9 deletions
diff --git a/starling/node.scm b/starling/node.scm
index 920a9bd..a0141c1 100644
--- a/starling/node.scm
+++ b/starling/node.scm
@@ -247,15 +247,14 @@ represented as a ratio in the range [0, 1]."
(define-method (detach (node <node>))
"Detach NODE from its parent."
(let ((p (parent node)))
- (unless p
- (error "node has no parent" node))
- (set! (children p) (delq node (children p)))
- (hashq-remove! (children-map p) (name node))
- ;; Detaching deactives the node and all of its children.
- (when (active? node)
- (deactivate node))
- (set! (parent node) #f)
- (on-detach p node)))
+ (when p
+ (set! (children p) (delq node (children p)))
+ (hashq-remove! (children-map p) (name node))
+ ;; Detaching deactives the node and all of its children.
+ (when (active? node)
+ (deactivate node))
+ (set! (parent node) #f)
+ (on-detach p node))))
(define-method (detach . nodes)
"Detach all NODES from their respective parents."