diff --git a/fdbserver/DeltaTree.h b/fdbserver/DeltaTree.h index 860f7fc22f..7c32e24ab5 100644 --- a/fdbserver/DeltaTree.h +++ b/fdbserver/DeltaTree.h @@ -386,7 +386,11 @@ public: // have changed (they won't if k already exists in the tree but was deleted). // Returns true if successful, false if k does not fit in the space available // or if k is already in the tree (and was not already deleted). + // Insertion on an empty tree returns false as well. bool insert(const T& k, int skipLen = 0, int maxHeightAllowed = std::numeric_limits::max()) { + if (root == nullptr) { + return false; + } int height = 1; DecodedNode* n = root; bool addLeftChild = false; @@ -432,7 +436,6 @@ public: return false; } - ASSERT(n != nullptr); // Insert k as the left or right child of n, depending on the value of addLeftChild // First, see if it will fit. const T* prev = addLeftChild ? n->prev : &n->item;