diff options
-rw-r--r-- | src/tree.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -183,14 +183,16 @@ mq_tree_remove_allocated(MqTree *node) { MqTree *child; - /* Link previous sibling or parent to children. */ + /* Link siblings and/or parent to children (may be NULL). */ if (node->prev) { node->prev->next = node->first_child; } else { node->parent->first_child = node->first_child; - if (!node->next) { - node->parent->last_child = node->last_child; - } + } + if (node->next) { + node->next->prev = node->last_child; + } else { + node->parent->last_child = node->last_child; } /* Link children to siblings (may be NULL). */ |