Skip to content

Commit fcbcb63

Browse files
committed
some fixes
1 parent 0747751 commit fcbcb63

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

include/phtree/common/b_plus_tree_multimap.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,10 @@ class b_plus_tree_multimap {
419419
if (data_.empty()) {
420420
// Nothing to merge, just remove node. This should be rare, i.e. only happens when
421421
// a rare 1-entry node has its last entry removed.
422+
auto next_node = next_node_; // create copy because (this) will be deleted
422423
remove_from_siblings();
423424
parent_->remove_node(max_key_old, this, tree);
424-
return next_node_ == nullptr ? ER{} : ER{next_node_, next_node_->data_.begin()};
425+
return next_node == nullptr ? ER{} : ER{next_node, next_node->data_.begin()};
425426
}
426427

427428
if (data_.size() < this->M_min()) {
@@ -500,9 +501,10 @@ class b_plus_tree_multimap {
500501
if (data_.empty()) {
501502
// Nothing to merge, just remove node. This should be rare, i.e. only happens when
502503
// a rare 1-entry node has its last entry removed.
504+
auto next_node = next_node_; // create copy because (this) will be deleted
503505
remove_from_siblings();
504506
parent_->remove_node(max_key_old, this, tree);
505-
return next_node_ == nullptr ? ER{} : ER{next_node_, next_node_->data_.begin()};
507+
return next_node == nullptr ? ER{} : ER{next_node, next_node->data_.begin()};
506508
}
507509

508510
if (data_.size() < this->M_min()) {

0 commit comments

Comments
 (0)